super-three 0.164.0 → 0.167.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/README.md +3 -3
- package/build/three.cjs +1273 -503
- package/build/three.module.js +1269 -504
- package/build/three.module.min.js +1 -1
- package/build/three.webgpu.js +76086 -0
- package/build/three.webgpu.min.js +6 -0
- package/examples/jsm/Addons.js +2 -1
- package/examples/jsm/controls/TransformControls.js +1 -1
- package/examples/jsm/csm/CSMShader.js +4 -4
- package/examples/jsm/environments/RoomEnvironment.js +1 -5
- package/examples/jsm/exporters/GLTFExporter.js +8 -4
- package/examples/jsm/exporters/USDZExporter.js +6 -4
- package/examples/jsm/geometries/TeapotGeometry.js +1 -1
- package/examples/jsm/helpers/ViewHelper.js +75 -61
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +91 -0
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +8 -63
- package/examples/jsm/lines/LineMaterial.js +1 -15
- package/examples/jsm/lines/LineSegments2.js +15 -0
- package/examples/jsm/lines/Wireframe.js +16 -1
- package/examples/jsm/lines/webgpu/Line2.js +20 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +376 -0
- package/examples/jsm/loaders/DRACOLoader.js +1 -1
- package/examples/jsm/loaders/FBXLoader.js +47 -58
- package/examples/jsm/loaders/GLTFLoader.js +12 -4
- package/examples/jsm/loaders/LDrawLoader.js +3 -2
- package/examples/jsm/loaders/MMDLoader.js +31 -12
- package/examples/jsm/loaders/MaterialXLoader.js +2 -9
- package/examples/jsm/loaders/USDZLoader.js +124 -76
- package/examples/jsm/loaders/UltraHDRLoader.js +583 -0
- package/examples/jsm/loaders/VTKLoader.js +76 -3
- package/examples/jsm/misc/GPUComputationRenderer.js +9 -19
- package/examples/jsm/modifiers/CurveModifier.js +11 -9
- package/examples/jsm/modifiers/SimplifyModifier.js +2 -1
- package/examples/jsm/objects/InstancedPoints.js +2 -2
- package/examples/jsm/objects/Lensflare.js +2 -2
- package/examples/jsm/postprocessing/RenderPass.js +1 -1
- package/examples/jsm/postprocessing/RenderTransitionPass.js +13 -38
- package/examples/jsm/postprocessing/SSAOPass.js +6 -9
- package/examples/jsm/postprocessing/UnrealBloomPass.js +4 -4
- package/examples/jsm/renderers/CSS2DRenderer.js +25 -5
- package/examples/jsm/renderers/CSS3DRenderer.js +24 -3
- package/examples/jsm/shaders/ColorifyShader.js +1 -2
- package/examples/jsm/shaders/FXAAShader.js +0 -2
- package/examples/jsm/shaders/GTAOShader.js +1 -1
- package/examples/jsm/shaders/LuminosityHighPassShader.js +1 -3
- package/examples/jsm/transpiler/GLSLDecoder.js +46 -4
- package/examples/jsm/transpiler/TSLEncoder.js +17 -15
- package/examples/jsm/utils/BufferGeometryUtils.js +18 -16
- package/examples/jsm/utils/GPUStatsPanel.js +2 -0
- package/examples/jsm/utils/SortUtils.js +8 -5
- package/package.json +9 -7
- package/src/Three.WebGPU.js +194 -0
- package/src/Three.js +2 -0
- package/src/animation/tracks/BooleanKeyframeTrack.js +10 -1
- package/src/animation/tracks/QuaternionKeyframeTrack.js +1 -2
- package/src/animation/tracks/StringKeyframeTrack.js +10 -1
- package/src/constants.js +4 -1
- package/src/core/Object3D.js +24 -22
- package/src/core/Raycaster.js +6 -2
- package/src/extras/TextureUtils.js +210 -0
- package/src/lights/Light.js +1 -0
- package/src/lights/LightShadow.js +5 -0
- package/{examples/jsm/lights → src/lights/webgpu}/IESSpotLight.js +1 -1
- package/src/loaders/FileLoader.js +4 -0
- package/src/loaders/LoaderUtils.js +3 -1
- package/src/loaders/ObjectLoader.js +34 -2
- package/src/materials/Material.js +13 -4
- package/src/math/Box2.js +4 -4
- package/src/math/Box3.js +6 -6
- package/src/math/ColorManagement.js +10 -0
- package/src/math/Matrix2.js +54 -0
- package/src/math/Vector4.js +13 -0
- package/{examples/jsm → src}/nodes/Nodes.js +39 -20
- package/{examples/jsm → src}/nodes/accessors/BatchNode.js +28 -10
- package/src/nodes/accessors/BitangentNode.js +13 -0
- package/{examples/jsm → src}/nodes/accessors/BufferAttributeNode.js +36 -1
- package/{examples/jsm → src}/nodes/accessors/BufferNode.js +6 -0
- package/src/nodes/accessors/CameraNode.js +19 -0
- package/{examples/jsm → src}/nodes/accessors/CubeTextureNode.js +22 -5
- package/src/nodes/accessors/InstanceNode.js +140 -0
- package/{examples/jsm → src}/nodes/accessors/MaterialNode.js +24 -2
- package/{examples/jsm → src}/nodes/accessors/ModelNode.js +4 -0
- package/{examples/jsm → src}/nodes/accessors/MorphNode.js +24 -20
- package/src/nodes/accessors/NormalNode.js +14 -0
- package/{examples/jsm → src}/nodes/accessors/Object3DNode.js +1 -1
- package/src/nodes/accessors/PositionNode.js +10 -0
- package/{examples/jsm → src}/nodes/accessors/ReferenceNode.js +7 -1
- package/src/nodes/accessors/ReflectVectorNode.js +10 -0
- package/{examples/jsm → src}/nodes/accessors/StorageBufferNode.js +50 -1
- package/{examples/jsm/nodes/accessors/TextureStoreNode.js → src/nodes/accessors/StorageTextureNode.js} +28 -6
- package/src/nodes/accessors/TangentNode.js +23 -0
- package/src/nodes/accessors/Texture3DNode.js +100 -0
- package/{examples/jsm → src}/nodes/accessors/TextureNode.js +55 -18
- package/src/nodes/accessors/UVNode.js +3 -0
- package/{examples/jsm → src}/nodes/accessors/UniformsNode.js +7 -1
- package/{examples/jsm → src}/nodes/accessors/VertexColorNode.js +2 -1
- package/{examples/jsm → src}/nodes/code/ScriptableNode.js +14 -0
- package/{examples/jsm → src}/nodes/code/ScriptableValueNode.js +2 -1
- package/{examples/jsm → src}/nodes/core/AttributeNode.js +34 -8
- package/{examples/jsm → src}/nodes/core/CacheNode.js +7 -10
- package/{examples/jsm → src}/nodes/core/ContextNode.js +6 -0
- package/{examples/jsm → src}/nodes/core/IndexNode.js +6 -0
- package/{examples/jsm → src}/nodes/core/LightingModel.js +2 -2
- package/src/nodes/core/MRTNode.js +76 -0
- package/{examples/jsm → src}/nodes/core/Node.js +33 -14
- package/{examples/jsm → src}/nodes/core/NodeBuilder.js +194 -45
- package/src/nodes/core/NodeCache.js +36 -0
- package/{examples/jsm → src}/nodes/core/NodeFrame.js +42 -0
- package/{examples/jsm → src}/nodes/core/NodeFunction.js +2 -2
- package/{examples/jsm → src}/nodes/core/NodeKeywords.js +1 -1
- package/{examples/jsm → src}/nodes/core/NodeUniform.js +1 -2
- package/{examples/jsm → src}/nodes/core/NodeUtils.js +6 -1
- package/{examples/jsm → src}/nodes/core/OutputStructNode.js +1 -5
- package/{examples/jsm → src}/nodes/core/PropertyNode.js +2 -0
- package/{examples/jsm → src}/nodes/core/TempNode.js +2 -2
- package/{examples/jsm → src}/nodes/core/UniformGroupNode.js +20 -0
- package/{examples/jsm → src}/nodes/core/UniformNode.js +10 -1
- package/{examples/jsm → src}/nodes/core/VarNode.js +2 -6
- package/src/nodes/core/VaryingNode.js +104 -0
- package/{examples/jsm → src}/nodes/display/AfterImageNode.js +24 -20
- package/{examples/jsm → src}/nodes/display/AnamorphicNode.js +18 -21
- package/src/nodes/display/BloomNode.js +333 -0
- package/{examples/jsm → src}/nodes/display/ColorAdjustmentNode.js +7 -2
- package/{examples/jsm → src}/nodes/display/ColorSpaceNode.js +1 -1
- package/src/nodes/display/DenoiseNode.js +198 -0
- package/src/nodes/display/DepthOfFieldNode.js +119 -0
- package/src/nodes/display/DotScreenNode.js +75 -0
- package/src/nodes/display/FXAANode.js +327 -0
- package/src/nodes/display/FilmNode.js +52 -0
- package/{examples/jsm → src}/nodes/display/FrontFacingNode.js +2 -1
- package/src/nodes/display/GTAONode.js +324 -0
- package/{examples/jsm → src}/nodes/display/GaussianBlurNode.js +34 -17
- package/src/nodes/display/Lut3DNode.js +53 -0
- package/{examples/jsm → src}/nodes/display/NormalMapNode.js +1 -1
- package/src/nodes/display/PassNode.js +291 -0
- package/src/nodes/display/PixelationPassNode.js +201 -0
- package/src/nodes/display/RGBShiftNode.js +49 -0
- package/src/nodes/display/RenderOutputNode.js +56 -0
- package/src/nodes/display/SobelOperatorNode.js +121 -0
- package/{examples/jsm → src}/nodes/display/ToneMappingNode.js +44 -5
- package/src/nodes/display/TransitionNode.js +76 -0
- package/{examples/jsm → src}/nodes/display/ViewportDepthNode.js +39 -16
- package/{examples/jsm → src}/nodes/display/ViewportDepthTextureNode.js +2 -1
- package/{examples/jsm → src}/nodes/display/ViewportNode.js +3 -2
- package/{examples/jsm → src}/nodes/display/ViewportSharedTextureNode.js +2 -1
- package/{examples/jsm → src}/nodes/display/ViewportTextureNode.js +5 -2
- package/src/nodes/functions/BSDF/LTC.js +131 -0
- package/src/nodes/functions/BasicLightingModel.js +78 -0
- package/{examples/jsm → src}/nodes/functions/PhongLightingModel.js +5 -3
- package/{examples/jsm → src}/nodes/functions/PhysicalLightingModel.js +103 -18
- package/src/nodes/functions/ToonLightingModel.js +51 -0
- package/{examples/jsm → src}/nodes/geometry/RangeNode.js +19 -6
- package/{examples/jsm → src}/nodes/lighting/AONode.js +1 -4
- package/{examples/jsm → src}/nodes/lighting/AmbientLightNode.js +1 -1
- package/src/nodes/lighting/AnalyticLightNode.js +333 -0
- package/src/nodes/lighting/BasicEnvironmentNode.js +26 -0
- package/src/nodes/lighting/BasicLightMapNode.js +29 -0
- package/{examples/jsm → src}/nodes/lighting/DirectionalLightNode.js +2 -3
- package/{examples/jsm → src}/nodes/lighting/EnvironmentNode.js +5 -4
- package/{examples/jsm → src}/nodes/lighting/HemisphereLightNode.js +2 -1
- package/{examples/jsm → src}/nodes/lighting/IESSpotLightNode.js +1 -1
- package/{examples/jsm → src}/nodes/lighting/LightingNode.js +2 -0
- package/{examples/jsm → src}/nodes/lighting/LightsNode.js +18 -3
- package/{examples/jsm → src}/nodes/lighting/PointLightNode.js +2 -3
- package/src/nodes/lighting/RectAreaLightNode.js +97 -0
- package/{examples/jsm → src}/nodes/lighting/SpotLightNode.js +2 -3
- package/{examples/jsm → src}/nodes/loaders/NodeLoader.js +3 -1
- package/{examples/jsm → src}/nodes/loaders/NodeMaterialLoader.js +2 -1
- package/{examples/jsm → src}/nodes/loaders/NodeObjectLoader.js +2 -1
- package/{examples/jsm → src}/nodes/materials/InstancedPointsNodeMaterial.js +3 -3
- package/{examples/jsm → src}/nodes/materials/Line2NodeMaterial.js +4 -4
- package/{examples/jsm → src}/nodes/materials/LineBasicNodeMaterial.js +3 -3
- package/{examples/jsm → src}/nodes/materials/LineDashedNodeMaterial.js +4 -3
- package/{examples/jsm → src}/nodes/materials/Materials.js +3 -0
- package/src/nodes/materials/MeshBasicNodeMaterial.js +73 -0
- package/{examples/jsm → src}/nodes/materials/MeshLambertNodeMaterial.js +12 -3
- package/src/nodes/materials/MeshMatcapNodeMaterial.js +53 -0
- package/{examples/jsm → src}/nodes/materials/MeshNormalNodeMaterial.js +5 -3
- package/{examples/jsm → src}/nodes/materials/MeshPhongNodeMaterial.js +11 -3
- package/{examples/jsm → src}/nodes/materials/MeshPhysicalNodeMaterial.js +26 -8
- package/{examples/jsm → src}/nodes/materials/MeshStandardNodeMaterial.js +14 -3
- package/src/nodes/materials/MeshToonNodeMaterial.js +34 -0
- package/{examples/jsm → src}/nodes/materials/NodeMaterial.js +97 -24
- package/{examples/jsm → src}/nodes/materials/PointsNodeMaterial.js +3 -3
- package/{examples/jsm → src}/nodes/materials/ShadowNodeMaterial.js +3 -3
- package/{examples/jsm → src}/nodes/materials/SpriteNodeMaterial.js +3 -3
- package/src/nodes/materials/VolumeNodeMaterial.js +106 -0
- package/{examples/jsm → src}/nodes/materialx/lib/mx_hsv.js +9 -17
- package/{examples/jsm → src}/nodes/materialx/lib/mx_noise.js +474 -577
- package/{examples/jsm → src}/nodes/materialx/lib/mx_transform_color.js +2 -8
- package/{examples/jsm → src}/nodes/math/CondNode.js +13 -6
- package/{examples/jsm → src}/nodes/math/HashNode.js +2 -2
- package/{examples/jsm → src}/nodes/math/MathNode.js +14 -1
- package/{examples/jsm → src}/nodes/math/OperatorNode.js +6 -6
- package/{examples/jsm → src}/nodes/parsers/GLSLNodeFunction.js +7 -7
- package/{examples/jsm → src}/nodes/pmrem/PMREMNode.js +2 -1
- package/{examples/jsm → src}/nodes/shadernode/ShaderNode.js +57 -33
- package/{examples/jsm → src}/nodes/utils/ArrayElementNode.js +1 -1
- package/{examples/jsm → src}/nodes/utils/DiscardNode.js +1 -0
- package/{examples/jsm → src}/nodes/utils/FunctionOverloadingNode.js +2 -0
- package/{examples/jsm → src}/nodes/utils/LoopNode.js +7 -6
- package/{examples/jsm → src}/nodes/utils/MatcapUVNode.js +1 -1
- package/{examples/jsm → src}/nodes/utils/MaxMipLevelNode.js +8 -2
- package/src/nodes/utils/RTTNode.js +130 -0
- package/{examples/jsm → src}/nodes/utils/ReflectorNode.js +9 -1
- package/{examples/jsm → src}/nodes/utils/TimerNode.js +1 -1
- package/src/objects/BatchedMesh.js +232 -162
- package/src/objects/InstancedMesh.js +1 -1
- package/src/renderers/WebGLRenderer.js +312 -68
- package/{examples/jsm → src}/renderers/common/Attributes.js +4 -1
- package/{examples/jsm → src}/renderers/common/Backend.js +30 -27
- package/{examples/jsm → src}/renderers/common/Background.js +9 -3
- package/src/renderers/common/BindGroup.js +16 -0
- package/{examples/jsm → src}/renderers/common/Bindings.js +54 -22
- package/src/renderers/common/ChainMap.js +59 -0
- package/{examples/jsm → src}/renderers/common/ClippingContext.js +8 -6
- package/{examples/jsm → src}/renderers/common/Color4.js +1 -1
- package/{examples/jsm → src}/renderers/common/CubeRenderTarget.js +7 -1
- package/{examples/jsm → src}/renderers/common/Geometries.js +37 -5
- package/{examples/jsm → src}/renderers/common/Info.js +34 -6
- package/{examples/jsm → src}/renderers/common/Pipelines.js +2 -2
- package/src/renderers/common/PostProcessing.js +87 -0
- package/{examples/jsm/objects → src/renderers/common}/QuadMesh.js +6 -3
- package/src/renderers/common/RenderBundle.js +18 -0
- package/src/renderers/common/RenderBundles.js +38 -0
- package/{examples/jsm → src}/renderers/common/RenderContext.js +1 -1
- package/{examples/jsm → src}/renderers/common/RenderContexts.js +1 -1
- package/{examples/jsm → src}/renderers/common/RenderList.js +9 -0
- package/{examples/jsm → src}/renderers/common/RenderObject.js +50 -11
- package/{examples/jsm → src}/renderers/common/Renderer.js +220 -40
- package/{examples/jsm → src}/renderers/common/SampledTexture.js +2 -2
- package/{examples/jsm → src}/renderers/common/StorageBufferAttribute.js +1 -1
- package/{examples/jsm → src}/renderers/common/StorageInstancedBufferAttribute.js +1 -1
- package/{examples/jsm → src}/renderers/common/StorageTexture.js +2 -1
- package/{examples/jsm → src}/renderers/common/Textures.js +6 -2
- package/{examples/jsm → src}/renderers/common/Uniform.js +10 -5
- package/{examples/jsm → src}/renderers/common/UniformsGroup.js +69 -31
- package/{examples/jsm → src}/renderers/common/extras/PMREMGenerator.js +13 -12
- package/src/renderers/common/nodes/NodeBuilderState.js +58 -0
- package/{examples/jsm → src}/renderers/common/nodes/NodeSampledTexture.js +19 -4
- package/{examples/jsm → src}/renderers/common/nodes/NodeSampler.js +8 -1
- package/{examples/jsm → src}/renderers/common/nodes/NodeStorageBuffer.js +5 -1
- package/{examples/jsm → src}/renderers/common/nodes/NodeUniform.js +3 -3
- package/{examples/jsm → src}/renderers/common/nodes/NodeUniformBuffer.js +2 -1
- package/{examples/jsm → src}/renderers/common/nodes/NodeUniformsGroup.js +2 -8
- package/{examples/jsm → src}/renderers/common/nodes/Nodes.js +37 -16
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +31 -1
- package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +9 -1
- package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +0 -9
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -10
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +3 -3
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +8 -22
- package/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +3 -14
- package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +10 -31
- package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +3 -23
- package/src/renderers/shaders/ShaderChunk/packing.glsl.js +45 -13
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +7 -4
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +3 -0
- package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +3 -3
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +8 -0
- package/src/renderers/shaders/UniformsLib.js +3 -0
- package/src/renderers/webgl/WebGLAttributes.js +2 -2
- package/src/renderers/webgl/WebGLBackground.js +6 -0
- package/src/renderers/webgl/WebGLBufferRenderer.js +6 -19
- package/src/renderers/webgl/WebGLExtensions.js +3 -1
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +6 -18
- package/src/renderers/webgl/WebGLLights.js +15 -12
- package/src/renderers/webgl/WebGLMaterials.js +1 -5
- package/src/renderers/webgl/WebGLMorphtargets.js +1 -2
- package/src/renderers/webgl/WebGLProgram.js +28 -31
- package/src/renderers/webgl/WebGLPrograms.js +15 -15
- package/src/renderers/webgl/WebGLRenderStates.js +2 -2
- package/src/renderers/webgl/WebGLTextures.js +100 -70
- package/src/renderers/webgl/WebGLUniforms.js +12 -2
- package/src/renderers/webgl/WebGLUniformsGroups.js +7 -7
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/WebGLBackend.js +156 -54
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/nodes/GLSLNodeBuilder.js +188 -41
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLAttributeUtils.js +2 -2
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLConstants.js +1 -0
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLExtensions.js +2 -0
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLState.js +1 -1
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLTextureUtils.js +126 -7
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLUtils.js +1 -1
- package/{examples/jsm → src}/renderers/webgpu/WebGPUBackend.js +212 -78
- package/{examples/jsm → src}/renderers/webgpu/WebGPURenderer.js +2 -2
- package/{examples/jsm → src}/renderers/webgpu/nodes/WGSLNodeBuilder.js +245 -49
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +159 -0
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUAttributeUtils.js +2 -1
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUBindingUtils.js +30 -14
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUConstants.js +9 -1
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUPipelineUtils.js +74 -24
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUTextureUtils.js +101 -25
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUUtils.js +24 -3
- package/src/renderers/webxr/WebXRDepthSensing.js +9 -3
- package/src/renderers/webxr/WebXRManager.js +12 -2
- package/src/textures/CompressedArrayTexture.js +14 -0
- package/src/textures/DataArrayTexture.js +14 -0
- package/src/textures/DepthTexture.js +1 -3
- package/src/utils.js +30 -1
- package/examples/jsm/nodes/accessors/BitangentNode.js +0 -89
- package/examples/jsm/nodes/accessors/CameraNode.js +0 -119
- package/examples/jsm/nodes/accessors/InstanceNode.js +0 -94
- package/examples/jsm/nodes/accessors/NormalNode.js +0 -106
- package/examples/jsm/nodes/accessors/PositionNode.js +0 -104
- package/examples/jsm/nodes/accessors/ReflectVectorNode.js +0 -35
- package/examples/jsm/nodes/accessors/TangentNode.js +0 -109
- package/examples/jsm/nodes/accessors/UVNode.js +0 -47
- package/examples/jsm/nodes/core/NodeCache.js +0 -26
- package/examples/jsm/nodes/core/VaryingNode.js +0 -65
- package/examples/jsm/nodes/display/PassNode.js +0 -199
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +0 -255
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +0 -28
- package/examples/jsm/renderers/common/ChainMap.js +0 -89
- package/examples/jsm/renderers/common/PostProcessing.js +0 -33
- package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +0 -44
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeFunction.js +0 -104
- /package/{examples/jsm → src}/nodes/accessors/AccessorsUtils.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/ClippingNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/InstancedPointsMaterialNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/MaterialReferenceNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/ModelViewProjectionNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/PointUVNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/RendererReferenceNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/SceneNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/SkinningNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/TextureBicubicNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/TextureSizeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/UserDataNode.js +0 -0
- /package/{examples/jsm → src}/nodes/code/CodeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/code/ExpressionNode.js +0 -0
- /package/{examples/jsm → src}/nodes/code/FunctionCallNode.js +0 -0
- /package/{examples/jsm → src}/nodes/code/FunctionNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/AssignNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/BypassNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/ConstNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/InputNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeAttribute.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeCode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeFunctionInput.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeParser.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeVar.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeVarying.js +0 -0
- /package/{examples/jsm → src}/nodes/core/ParameterNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/StackNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/StructTypeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/UniformGroup.js +0 -0
- /package/{examples/jsm → src}/nodes/core/constants.js +0 -0
- /package/{examples/jsm → src}/nodes/display/BlendModeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/display/BumpMapNode.js +0 -0
- /package/{examples/jsm → src}/nodes/display/PosterizeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/fog/FogExp2Node.js +0 -0
- /package/{examples/jsm → src}/nodes/fog/FogNode.js +0 -0
- /package/{examples/jsm → src}/nodes/fog/FogRangeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_GGX.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_Lambert.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_Sheen.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/DFGApprox.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/D_GGX.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/D_GGX_Anisotropic.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/EnvironmentBRDF.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/F_Schlick.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/Schlick_to_F0.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/ShadowMaskModel.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/material/getGeometryRoughness.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/material/getRoughness.js +0 -0
- /package/{examples/jsm → src}/nodes/gpgpu/ComputeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/lighting/IrradianceNode.js +0 -0
- /package/{examples/jsm → src}/nodes/lighting/LightNode.js +0 -0
- /package/{examples/jsm → src}/nodes/lighting/LightUtils.js +0 -0
- /package/{examples/jsm → src}/nodes/lighting/LightingContextNode.js +0 -0
- /package/{examples/jsm → src}/nodes/materials/MeshSSSNodeMaterial.js +0 -0
- /package/{examples/jsm → src}/nodes/materialx/DISCLAIMER.md +0 -0
- /package/{examples/jsm → src}/nodes/materialx/MaterialXNodes.js +0 -0
- /package/{examples/jsm → src}/nodes/math/MathUtils.js +0 -0
- /package/{examples/jsm → src}/nodes/math/TriNoise3D.js +0 -0
- /package/{examples/jsm → src}/nodes/parsers/GLSLNodeParser.js +0 -0
- /package/{examples/jsm → src}/nodes/pmrem/PMREMUtils.js +0 -0
- /package/{examples/jsm → src}/nodes/procedural/CheckerNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/ConvertNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/EquirectUVNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/JoinNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/OscNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/PackingNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/RemapNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/RotateNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/RotateUVNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/SetNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/SplitNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/SpriteSheetUVNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/StorageArrayElementNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/TriplanarTexturesNode.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Animation.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Binding.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Buffer.js +0 -0
- /package/{examples/jsm → src}/renderers/common/BufferUtils.js +0 -0
- /package/{examples/jsm → src}/renderers/common/ComputePipeline.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Constants.js +0 -0
- /package/{examples/jsm → src}/renderers/common/DataMap.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Pipeline.js +0 -0
- /package/{examples/jsm → src}/renderers/common/ProgrammableStage.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderLists.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderObjects.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderPipeline.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Sampler.js +0 -0
- /package/{examples/jsm → src}/renderers/common/StorageBuffer.js +0 -0
- /package/{examples/jsm → src}/renderers/common/UniformBuffer.js +0 -0
- /package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/WebGLBufferRenderer.js +0 -0
- /package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLCapabilities.js +0 -0
- /package/{examples/jsm → src}/renderers/webgpu/nodes/WGSLNodeParser.js +0 -0
- /package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUTexturePassUtils.js +0 -0
|
@@ -76,15 +76,36 @@ class WebGPUUtils {
|
|
|
76
76
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
getSampleCount(
|
|
79
|
+
getSampleCount( sampleCount ) {
|
|
80
|
+
|
|
81
|
+
let count = 1;
|
|
82
|
+
|
|
83
|
+
if ( sampleCount > 1 ) {
|
|
84
|
+
|
|
85
|
+
// WebGPU only supports power-of-two sample counts and 2 is not a valid value
|
|
86
|
+
count = Math.pow( 2, Math.floor( Math.log2( sampleCount ) ) );
|
|
87
|
+
|
|
88
|
+
if ( count === 2 ) {
|
|
89
|
+
|
|
90
|
+
count = 4;
|
|
91
|
+
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return count;
|
|
97
|
+
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
getSampleCountRenderContext( renderContext ) {
|
|
80
101
|
|
|
81
102
|
if ( renderContext.textures !== null ) {
|
|
82
103
|
|
|
83
|
-
return renderContext.sampleCount;
|
|
104
|
+
return this.getSampleCount( renderContext.sampleCount );
|
|
84
105
|
|
|
85
106
|
}
|
|
86
107
|
|
|
87
|
-
return this.backend.
|
|
108
|
+
return this.getSampleCount( this.backend.renderer.samples );
|
|
88
109
|
|
|
89
110
|
}
|
|
90
111
|
|
|
@@ -65,7 +65,7 @@ class WebXRDepthSensing {
|
|
|
65
65
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
getMesh( cameraXR ) {
|
|
69
69
|
|
|
70
70
|
if ( this.texture !== null ) {
|
|
71
71
|
|
|
@@ -86,10 +86,10 @@ class WebXRDepthSensing {
|
|
|
86
86
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
renderer.render( this.mesh, cameraXR );
|
|
90
|
-
|
|
91
89
|
}
|
|
92
90
|
|
|
91
|
+
return this.mesh;
|
|
92
|
+
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
reset() {
|
|
@@ -99,6 +99,12 @@ class WebXRDepthSensing {
|
|
|
99
99
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
getDepthTexture() {
|
|
103
|
+
|
|
104
|
+
return this.texture;
|
|
105
|
+
|
|
106
|
+
}
|
|
107
|
+
|
|
102
108
|
}
|
|
103
109
|
|
|
104
110
|
export { WebXRDepthSensing };
|
|
@@ -433,6 +433,12 @@ class WebXRManager extends EventDispatcher {
|
|
|
433
433
|
session.updateRenderState( { layers: layersCopy } );
|
|
434
434
|
}
|
|
435
435
|
|
|
436
|
+
this.getDepthTexture = function () {
|
|
437
|
+
|
|
438
|
+
return depthSensing.getDepthTexture();
|
|
439
|
+
|
|
440
|
+
};
|
|
441
|
+
|
|
436
442
|
function onInputSourcesChange( event ) {
|
|
437
443
|
|
|
438
444
|
// Notify disconnected
|
|
@@ -725,6 +731,12 @@ class WebXRManager extends EventDispatcher {
|
|
|
725
731
|
|
|
726
732
|
};
|
|
727
733
|
|
|
734
|
+
this.getDepthSensingMesh = function () {
|
|
735
|
+
|
|
736
|
+
return depthSensing.getMesh( cameraXR );
|
|
737
|
+
|
|
738
|
+
};
|
|
739
|
+
|
|
728
740
|
// Animation Loop
|
|
729
741
|
|
|
730
742
|
let onAnimationFrameCallback = null;
|
|
@@ -850,8 +862,6 @@ class WebXRManager extends EventDispatcher {
|
|
|
850
862
|
|
|
851
863
|
}
|
|
852
864
|
|
|
853
|
-
depthSensing.render( renderer, cameraXR );
|
|
854
|
-
|
|
855
865
|
if ( onAnimationFrameCallback ) onAnimationFrameCallback( time, frame );
|
|
856
866
|
|
|
857
867
|
if ( frame.detectedPlanes ) {
|
|
@@ -11,6 +11,20 @@ class CompressedArrayTexture extends CompressedTexture {
|
|
|
11
11
|
this.image.depth = depth;
|
|
12
12
|
this.wrapR = ClampToEdgeWrapping;
|
|
13
13
|
|
|
14
|
+
this.layerUpdates = new Set();
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
addLayerUpdate( layerIndex ) {
|
|
19
|
+
|
|
20
|
+
this.layerUpdates.add( layerIndex );
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
clearLayerUpdates() {
|
|
25
|
+
|
|
26
|
+
this.layerUpdates.clear();
|
|
27
|
+
|
|
14
28
|
}
|
|
15
29
|
|
|
16
30
|
}
|
|
@@ -20,6 +20,20 @@ class DataArrayTexture extends Texture {
|
|
|
20
20
|
this.flipY = false;
|
|
21
21
|
this.unpackAlignment = 1;
|
|
22
22
|
|
|
23
|
+
this.layerUpdates = new Set();
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
addLayerUpdate( layerIndex ) {
|
|
28
|
+
|
|
29
|
+
this.layerUpdates.add( layerIndex );
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
clearLayerUpdates() {
|
|
34
|
+
|
|
35
|
+
this.layerUpdates.clear();
|
|
36
|
+
|
|
23
37
|
}
|
|
24
38
|
|
|
25
39
|
}
|
|
@@ -3,9 +3,7 @@ import { NearestFilter, UnsignedIntType, UnsignedInt248Type, DepthFormat, DepthS
|
|
|
3
3
|
|
|
4
4
|
class DepthTexture extends Texture {
|
|
5
5
|
|
|
6
|
-
constructor( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format ) {
|
|
7
|
-
|
|
8
|
-
format = format !== undefined ? format : DepthFormat;
|
|
6
|
+
constructor( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format = DepthFormat ) {
|
|
9
7
|
|
|
10
8
|
if ( format !== DepthFormat && format !== DepthStencilFormat ) {
|
|
11
9
|
|
package/src/utils.js
CHANGED
|
@@ -88,4 +88,33 @@ function warnOnce( message ) {
|
|
|
88
88
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
function probeAsync( gl, sync, interval ) {
|
|
92
|
+
|
|
93
|
+
return new Promise( function ( resolve, reject ) {
|
|
94
|
+
|
|
95
|
+
function probe() {
|
|
96
|
+
|
|
97
|
+
switch ( gl.clientWaitSync( sync, gl.SYNC_FLUSH_COMMANDS_BIT, 0 ) ) {
|
|
98
|
+
|
|
99
|
+
case gl.WAIT_FAILED:
|
|
100
|
+
reject();
|
|
101
|
+
break;
|
|
102
|
+
|
|
103
|
+
case gl.TIMEOUT_EXPIRED:
|
|
104
|
+
setTimeout( probe, interval );
|
|
105
|
+
break;
|
|
106
|
+
|
|
107
|
+
default:
|
|
108
|
+
resolve();
|
|
109
|
+
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
setTimeout( probe, interval );
|
|
115
|
+
|
|
116
|
+
} );
|
|
117
|
+
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export { arrayMin, arrayMax, arrayNeedsUint32, getTypedArray, createElementNS, createCanvasElement, warnOnce, probeAsync };
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import Node, { addNodeClass } from '../core/Node.js';
|
|
2
|
-
import { varying } from '../core/VaryingNode.js';
|
|
3
|
-
import { normalize } from '../math/MathNode.js';
|
|
4
|
-
import { cameraViewMatrix } from './CameraNode.js';
|
|
5
|
-
import { normalGeometry, normalLocal, normalView, normalWorld, transformedNormalView } from './NormalNode.js';
|
|
6
|
-
import { tangentGeometry, tangentLocal, tangentView, tangentWorld, transformedTangentView } from './TangentNode.js';
|
|
7
|
-
import { nodeImmutable } from '../shadernode/ShaderNode.js';
|
|
8
|
-
|
|
9
|
-
class BitangentNode extends Node {
|
|
10
|
-
|
|
11
|
-
constructor( scope = BitangentNode.LOCAL ) {
|
|
12
|
-
|
|
13
|
-
super( 'vec3' );
|
|
14
|
-
|
|
15
|
-
this.scope = scope;
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
getHash( /*builder*/ ) {
|
|
20
|
-
|
|
21
|
-
return `bitangent-${this.scope}`;
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
generate( builder ) {
|
|
26
|
-
|
|
27
|
-
const scope = this.scope;
|
|
28
|
-
|
|
29
|
-
let crossNormalTangent;
|
|
30
|
-
|
|
31
|
-
if ( scope === BitangentNode.GEOMETRY ) {
|
|
32
|
-
|
|
33
|
-
crossNormalTangent = normalGeometry.cross( tangentGeometry );
|
|
34
|
-
|
|
35
|
-
} else if ( scope === BitangentNode.LOCAL ) {
|
|
36
|
-
|
|
37
|
-
crossNormalTangent = normalLocal.cross( tangentLocal );
|
|
38
|
-
|
|
39
|
-
} else if ( scope === BitangentNode.VIEW ) {
|
|
40
|
-
|
|
41
|
-
crossNormalTangent = normalView.cross( tangentView );
|
|
42
|
-
|
|
43
|
-
} else if ( scope === BitangentNode.WORLD ) {
|
|
44
|
-
|
|
45
|
-
crossNormalTangent = normalWorld.cross( tangentWorld );
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const vertexNode = crossNormalTangent.mul( tangentGeometry.w ).xyz;
|
|
50
|
-
|
|
51
|
-
const outputNode = normalize( varying( vertexNode ) );
|
|
52
|
-
|
|
53
|
-
return outputNode.build( builder, this.getNodeType( builder ) );
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
serialize( data ) {
|
|
58
|
-
|
|
59
|
-
super.serialize( data );
|
|
60
|
-
|
|
61
|
-
data.scope = this.scope;
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
deserialize( data ) {
|
|
66
|
-
|
|
67
|
-
super.deserialize( data );
|
|
68
|
-
|
|
69
|
-
this.scope = data.scope;
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
BitangentNode.GEOMETRY = 'geometry';
|
|
76
|
-
BitangentNode.LOCAL = 'local';
|
|
77
|
-
BitangentNode.VIEW = 'view';
|
|
78
|
-
BitangentNode.WORLD = 'world';
|
|
79
|
-
|
|
80
|
-
export default BitangentNode;
|
|
81
|
-
|
|
82
|
-
export const bitangentGeometry = nodeImmutable( BitangentNode, BitangentNode.GEOMETRY );
|
|
83
|
-
export const bitangentLocal = nodeImmutable( BitangentNode, BitangentNode.LOCAL );
|
|
84
|
-
export const bitangentView = nodeImmutable( BitangentNode, BitangentNode.VIEW );
|
|
85
|
-
export const bitangentWorld = nodeImmutable( BitangentNode, BitangentNode.WORLD );
|
|
86
|
-
export const transformedBitangentView = normalize( transformedNormalView.cross( transformedTangentView ).mul( tangentGeometry.w ) );
|
|
87
|
-
export const transformedBitangentWorld = normalize( transformedBitangentView.transformDirection( cameraViewMatrix ) );
|
|
88
|
-
|
|
89
|
-
addNodeClass( 'BitangentNode', BitangentNode );
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import Object3DNode from './Object3DNode.js';
|
|
2
|
-
import { addNodeClass } from '../core/Node.js';
|
|
3
|
-
import { NodeUpdateType } from '../core/constants.js';
|
|
4
|
-
//import { sharedUniformGroup } from '../core/UniformGroupNode.js';
|
|
5
|
-
import { nodeImmutable } from '../shadernode/ShaderNode.js';
|
|
6
|
-
|
|
7
|
-
//const cameraGroup = sharedUniformGroup( 'camera' );
|
|
8
|
-
|
|
9
|
-
class CameraNode extends Object3DNode {
|
|
10
|
-
|
|
11
|
-
constructor( scope = CameraNode.POSITION ) {
|
|
12
|
-
|
|
13
|
-
super( scope );
|
|
14
|
-
|
|
15
|
-
this.updateType = NodeUpdateType.RENDER;
|
|
16
|
-
|
|
17
|
-
//this._uniformNode.groupNode = cameraGroup;
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
getNodeType( builder ) {
|
|
22
|
-
|
|
23
|
-
const scope = this.scope;
|
|
24
|
-
|
|
25
|
-
if ( scope === CameraNode.PROJECTION_MATRIX || scope === CameraNode.PROJECTION_MATRIX_INVERSE ) {
|
|
26
|
-
|
|
27
|
-
return 'mat4';
|
|
28
|
-
|
|
29
|
-
} else if ( scope === CameraNode.NEAR || scope === CameraNode.FAR || scope === CameraNode.LOG_DEPTH ) {
|
|
30
|
-
|
|
31
|
-
return 'float';
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return super.getNodeType( builder );
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
update( frame ) {
|
|
40
|
-
|
|
41
|
-
const camera = frame.camera;
|
|
42
|
-
const uniformNode = this._uniformNode;
|
|
43
|
-
const scope = this.scope;
|
|
44
|
-
|
|
45
|
-
//cameraGroup.needsUpdate = true;
|
|
46
|
-
|
|
47
|
-
if ( scope === CameraNode.VIEW_MATRIX ) {
|
|
48
|
-
|
|
49
|
-
uniformNode.value = camera.matrixWorldInverse;
|
|
50
|
-
|
|
51
|
-
} else if ( scope === CameraNode.PROJECTION_MATRIX ) {
|
|
52
|
-
|
|
53
|
-
uniformNode.value = camera.projectionMatrix;
|
|
54
|
-
|
|
55
|
-
} else if ( scope === CameraNode.PROJECTION_MATRIX_INVERSE ) {
|
|
56
|
-
|
|
57
|
-
uniformNode.value = camera.projectionMatrixInverse;
|
|
58
|
-
|
|
59
|
-
} else if ( scope === CameraNode.NEAR ) {
|
|
60
|
-
|
|
61
|
-
uniformNode.value = camera.near;
|
|
62
|
-
|
|
63
|
-
} else if ( scope === CameraNode.FAR ) {
|
|
64
|
-
|
|
65
|
-
uniformNode.value = camera.far;
|
|
66
|
-
|
|
67
|
-
} else if ( scope === CameraNode.LOG_DEPTH ) {
|
|
68
|
-
|
|
69
|
-
uniformNode.value = 2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 );
|
|
70
|
-
|
|
71
|
-
} else {
|
|
72
|
-
|
|
73
|
-
this.object3d = camera;
|
|
74
|
-
|
|
75
|
-
super.update( frame );
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
generate( builder ) {
|
|
82
|
-
|
|
83
|
-
const scope = this.scope;
|
|
84
|
-
|
|
85
|
-
if ( scope === CameraNode.PROJECTION_MATRIX || scope === CameraNode.PROJECTION_MATRIX_INVERSE ) {
|
|
86
|
-
|
|
87
|
-
this._uniformNode.nodeType = 'mat4';
|
|
88
|
-
|
|
89
|
-
} else if ( scope === CameraNode.NEAR || scope === CameraNode.FAR || scope === CameraNode.LOG_DEPTH ) {
|
|
90
|
-
|
|
91
|
-
this._uniformNode.nodeType = 'float';
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return super.generate( builder );
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
CameraNode.PROJECTION_MATRIX = 'projectionMatrix';
|
|
102
|
-
CameraNode.PROJECTION_MATRIX_INVERSE = 'projectionMatrixInverse';
|
|
103
|
-
CameraNode.NEAR = 'near';
|
|
104
|
-
CameraNode.FAR = 'far';
|
|
105
|
-
CameraNode.LOG_DEPTH = 'logDepth';
|
|
106
|
-
|
|
107
|
-
export default CameraNode;
|
|
108
|
-
|
|
109
|
-
export const cameraProjectionMatrix = nodeImmutable( CameraNode, CameraNode.PROJECTION_MATRIX );
|
|
110
|
-
export const cameraProjectionMatrixInverse = nodeImmutable( CameraNode, CameraNode.PROJECTION_MATRIX_INVERSE );
|
|
111
|
-
export const cameraNear = nodeImmutable( CameraNode, CameraNode.NEAR );
|
|
112
|
-
export const cameraFar = nodeImmutable( CameraNode, CameraNode.FAR );
|
|
113
|
-
export const cameraLogDepth = nodeImmutable( CameraNode, CameraNode.LOG_DEPTH );
|
|
114
|
-
export const cameraViewMatrix = nodeImmutable( CameraNode, CameraNode.VIEW_MATRIX );
|
|
115
|
-
export const cameraNormalMatrix = nodeImmutable( CameraNode, CameraNode.NORMAL_MATRIX );
|
|
116
|
-
export const cameraWorldMatrix = nodeImmutable( CameraNode, CameraNode.WORLD_MATRIX );
|
|
117
|
-
export const cameraPosition = nodeImmutable( CameraNode, CameraNode.POSITION );
|
|
118
|
-
|
|
119
|
-
addNodeClass( 'CameraNode', CameraNode );
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import Node, { addNodeClass } from '../core/Node.js';
|
|
2
|
-
import { varyingProperty } from '../core/PropertyNode.js';
|
|
3
|
-
import { instancedBufferAttribute, instancedDynamicBufferAttribute } from './BufferAttributeNode.js';
|
|
4
|
-
import { normalLocal } from './NormalNode.js';
|
|
5
|
-
import { positionLocal } from './PositionNode.js';
|
|
6
|
-
import { nodeProxy, vec3, mat3, mat4 } from '../shadernode/ShaderNode.js';
|
|
7
|
-
import { DynamicDrawUsage, InstancedInterleavedBuffer, InstancedBufferAttribute } from 'three';
|
|
8
|
-
|
|
9
|
-
class InstanceNode extends Node {
|
|
10
|
-
|
|
11
|
-
constructor( instanceMesh ) {
|
|
12
|
-
|
|
13
|
-
super( 'void' );
|
|
14
|
-
|
|
15
|
-
this.instanceMesh = instanceMesh;
|
|
16
|
-
|
|
17
|
-
this.instanceMatrixNode = null;
|
|
18
|
-
|
|
19
|
-
this.instanceColorNode = null;
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
setup( /*builder*/ ) {
|
|
24
|
-
|
|
25
|
-
let instanceMatrixNode = this.instanceMatrixNode;
|
|
26
|
-
|
|
27
|
-
const instanceMesh = this.instanceMesh;
|
|
28
|
-
|
|
29
|
-
if ( instanceMatrixNode === null ) {
|
|
30
|
-
|
|
31
|
-
const instanceAttribute = instanceMesh.instanceMatrix;
|
|
32
|
-
const buffer = new InstancedInterleavedBuffer( instanceAttribute.array, 16, 1 );
|
|
33
|
-
|
|
34
|
-
const bufferFn = instanceAttribute.usage === DynamicDrawUsage ? instancedDynamicBufferAttribute : instancedBufferAttribute;
|
|
35
|
-
|
|
36
|
-
const instanceBuffers = [
|
|
37
|
-
// F.Signature -> bufferAttribute( array, type, stride, offset )
|
|
38
|
-
bufferFn( buffer, 'vec4', 16, 0 ),
|
|
39
|
-
bufferFn( buffer, 'vec4', 16, 4 ),
|
|
40
|
-
bufferFn( buffer, 'vec4', 16, 8 ),
|
|
41
|
-
bufferFn( buffer, 'vec4', 16, 12 )
|
|
42
|
-
];
|
|
43
|
-
|
|
44
|
-
instanceMatrixNode = mat4( ...instanceBuffers );
|
|
45
|
-
|
|
46
|
-
this.instanceMatrixNode = instanceMatrixNode;
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const instanceColorAttribute = instanceMesh.instanceColor;
|
|
51
|
-
|
|
52
|
-
if ( instanceColorAttribute && this.instanceColorNode === null ) {
|
|
53
|
-
|
|
54
|
-
const buffer = new InstancedBufferAttribute( instanceColorAttribute.array, 3 );
|
|
55
|
-
const bufferFn = instanceColorAttribute.usage === DynamicDrawUsage ? instancedDynamicBufferAttribute : instancedBufferAttribute;
|
|
56
|
-
|
|
57
|
-
this.instanceColorNode = vec3( bufferFn( buffer, 'vec3', 3, 0 ) );
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// POSITION
|
|
62
|
-
|
|
63
|
-
const instancePosition = instanceMatrixNode.mul( positionLocal ).xyz;
|
|
64
|
-
|
|
65
|
-
// NORMAL
|
|
66
|
-
|
|
67
|
-
const m = mat3( instanceMatrixNode[ 0 ].xyz, instanceMatrixNode[ 1 ].xyz, instanceMatrixNode[ 2 ].xyz );
|
|
68
|
-
|
|
69
|
-
const transformedNormal = normalLocal.div( vec3( m[ 0 ].dot( m[ 0 ] ), m[ 1 ].dot( m[ 1 ] ), m[ 2 ].dot( m[ 2 ] ) ) );
|
|
70
|
-
|
|
71
|
-
const instanceNormal = m.mul( transformedNormal ).xyz;
|
|
72
|
-
|
|
73
|
-
// ASSIGNS
|
|
74
|
-
|
|
75
|
-
positionLocal.assign( instancePosition );
|
|
76
|
-
normalLocal.assign( instanceNormal );
|
|
77
|
-
|
|
78
|
-
// COLOR
|
|
79
|
-
|
|
80
|
-
if ( this.instanceColorNode !== null ) {
|
|
81
|
-
|
|
82
|
-
varyingProperty( 'vec3', 'vInstanceColor' ).assign( this.instanceColorNode );
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export default InstanceNode;
|
|
91
|
-
|
|
92
|
-
export const instance = nodeProxy( InstanceNode );
|
|
93
|
-
|
|
94
|
-
addNodeClass( 'InstanceNode', InstanceNode );
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import Node, { addNodeClass } from '../core/Node.js';
|
|
2
|
-
import { attribute } from '../core/AttributeNode.js';
|
|
3
|
-
import { varying } from '../core/VaryingNode.js';
|
|
4
|
-
import { property } from '../core/PropertyNode.js';
|
|
5
|
-
import { normalize } from '../math/MathNode.js';
|
|
6
|
-
import { cameraViewMatrix } from './CameraNode.js';
|
|
7
|
-
import { modelNormalMatrix } from './ModelNode.js';
|
|
8
|
-
import { nodeImmutable, vec3 } from '../shadernode/ShaderNode.js';
|
|
9
|
-
|
|
10
|
-
class NormalNode extends Node {
|
|
11
|
-
|
|
12
|
-
constructor( scope = NormalNode.LOCAL ) {
|
|
13
|
-
|
|
14
|
-
super( 'vec3' );
|
|
15
|
-
|
|
16
|
-
this.scope = scope;
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
isGlobal() {
|
|
21
|
-
|
|
22
|
-
return true;
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
getHash( /*builder*/ ) {
|
|
27
|
-
|
|
28
|
-
return `normal-${this.scope}`;
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
generate( builder ) {
|
|
33
|
-
|
|
34
|
-
const scope = this.scope;
|
|
35
|
-
|
|
36
|
-
let outputNode = null;
|
|
37
|
-
|
|
38
|
-
if ( scope === NormalNode.GEOMETRY ) {
|
|
39
|
-
|
|
40
|
-
const geometryAttribute = builder.hasGeometryAttribute( 'normal' );
|
|
41
|
-
|
|
42
|
-
if ( geometryAttribute === false ) {
|
|
43
|
-
|
|
44
|
-
outputNode = vec3( 0, 1, 0 );
|
|
45
|
-
|
|
46
|
-
} else {
|
|
47
|
-
|
|
48
|
-
outputNode = attribute( 'normal', 'vec3' );
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
} else if ( scope === NormalNode.LOCAL ) {
|
|
53
|
-
|
|
54
|
-
outputNode = varying( normalGeometry );
|
|
55
|
-
|
|
56
|
-
} else if ( scope === NormalNode.VIEW ) {
|
|
57
|
-
|
|
58
|
-
const vertexNode = modelNormalMatrix.mul( normalLocal );
|
|
59
|
-
outputNode = normalize( varying( vertexNode ) );
|
|
60
|
-
|
|
61
|
-
} else if ( scope === NormalNode.WORLD ) {
|
|
62
|
-
|
|
63
|
-
// To use inverseTransformDirection only inverse the param order like this: cameraViewMatrix.transformDirection( normalView )
|
|
64
|
-
const vertexNode = normalView.transformDirection( cameraViewMatrix );
|
|
65
|
-
outputNode = normalize( varying( vertexNode ) );
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return outputNode.build( builder, this.getNodeType( builder ) );
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
serialize( data ) {
|
|
74
|
-
|
|
75
|
-
super.serialize( data );
|
|
76
|
-
|
|
77
|
-
data.scope = this.scope;
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
deserialize( data ) {
|
|
82
|
-
|
|
83
|
-
super.deserialize( data );
|
|
84
|
-
|
|
85
|
-
this.scope = data.scope;
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
NormalNode.GEOMETRY = 'geometry';
|
|
92
|
-
NormalNode.LOCAL = 'local';
|
|
93
|
-
NormalNode.VIEW = 'view';
|
|
94
|
-
NormalNode.WORLD = 'world';
|
|
95
|
-
|
|
96
|
-
export default NormalNode;
|
|
97
|
-
|
|
98
|
-
export const normalGeometry = nodeImmutable( NormalNode, NormalNode.GEOMETRY );
|
|
99
|
-
export const normalLocal = nodeImmutable( NormalNode, NormalNode.LOCAL ).temp( 'Normal' );
|
|
100
|
-
export const normalView = nodeImmutable( NormalNode, NormalNode.VIEW );
|
|
101
|
-
export const normalWorld = nodeImmutable( NormalNode, NormalNode.WORLD );
|
|
102
|
-
export const transformedNormalView = property( 'vec3', 'TransformedNormalView' );
|
|
103
|
-
export const transformedNormalWorld = transformedNormalView.transformDirection( cameraViewMatrix ).normalize();
|
|
104
|
-
export const transformedClearcoatNormalView = property( 'vec3', 'TransformedClearcoatNormalView' );
|
|
105
|
-
|
|
106
|
-
addNodeClass( 'NormalNode', NormalNode );
|