super-three 0.157.1 → 0.160.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 +6 -4
- package/build/three.cjs +3100 -1537
- package/build/three.js +3100 -1537
- package/build/three.min.js +1 -1
- package/build/three.module.js +3093 -1538
- package/build/three.module.min.js +1 -1
- package/examples/jsm/Addons.js +291 -0
- package/examples/jsm/controls/FlyControls.js +26 -0
- package/examples/jsm/controls/OrbitControls.js +62 -41
- package/examples/jsm/controls/TransformControls.js +27 -11
- package/examples/jsm/csm/CSMShader.js +53 -48
- package/examples/jsm/exporters/GLTFExporter.js +151 -3
- package/examples/jsm/exporters/USDZExporter.js +27 -19
- package/examples/jsm/geometries/InstancedPointsGeometry.js +174 -0
- package/examples/jsm/geometries/SDFGeometryGenerator.js +144 -0
- package/examples/jsm/helpers/TextureHelper.js +237 -0
- package/examples/jsm/interactive/HTMLMesh.js +9 -2
- package/examples/jsm/libs/lottie_canvas.module.js +6 -1
- package/examples/jsm/libs/opentype.module.js +13 -75
- package/examples/jsm/libs/surfaceNet.js +201 -0
- package/examples/jsm/lines/LineMaterial.js +16 -33
- package/examples/jsm/loaders/ColladaLoader.js +0 -6
- package/examples/jsm/loaders/DRACOLoader.js +4 -3
- package/examples/jsm/loaders/FBXLoader.js +294 -124
- package/examples/jsm/loaders/GLTFLoader.js +83 -6
- package/examples/jsm/loaders/LUTImageLoader.js +162 -0
- package/examples/jsm/loaders/MaterialXLoader.js +73 -54
- package/examples/jsm/loaders/NRRDLoader.js +0 -13
- package/examples/jsm/loaders/SVGLoader.js +4 -4
- package/examples/jsm/loaders/USDZLoader.js +3 -17
- package/examples/jsm/loaders/lwo/IFFParser.js +89 -93
- package/examples/jsm/materials/MeshGouraudMaterial.js +2 -0
- package/examples/jsm/math/Capsule.js +0 -55
- package/examples/jsm/math/Octree.js +85 -7
- package/examples/jsm/misc/Timer.js +119 -0
- package/examples/jsm/misc/TubePainter.js +3 -6
- package/examples/jsm/modifiers/CurveModifier.js +20 -2
- package/examples/jsm/modifiers/SimplifyModifier.js +103 -11
- package/examples/jsm/modifiers/TessellateModifier.js +3 -3
- package/examples/jsm/nodes/Nodes.js +16 -12
- package/examples/jsm/nodes/accessors/CameraNode.js +18 -2
- package/examples/jsm/nodes/accessors/CubeTextureNode.js +5 -73
- package/examples/jsm/nodes/accessors/InstanceNode.js +3 -3
- package/examples/jsm/nodes/accessors/InstancedPointsMaterialNode.js +21 -0
- package/examples/jsm/nodes/accessors/MaterialNode.js +68 -31
- package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +11 -2
- package/examples/jsm/nodes/accessors/ModelNode.js +1 -2
- package/examples/jsm/nodes/accessors/ModelViewProjectionNode.js +12 -3
- package/examples/jsm/nodes/accessors/MorphNode.js +191 -16
- package/examples/jsm/nodes/accessors/NormalNode.js +1 -1
- package/examples/jsm/nodes/accessors/PositionNode.js +1 -1
- package/examples/jsm/nodes/accessors/ReferenceNode.js +25 -1
- package/examples/jsm/nodes/accessors/SkinningNode.js +13 -3
- package/examples/jsm/nodes/accessors/TextureNode.js +123 -37
- package/examples/jsm/nodes/code/CodeNode.js +3 -3
- package/examples/jsm/nodes/code/FunctionNode.js +1 -1
- package/examples/jsm/nodes/core/AssignNode.js +72 -0
- package/examples/jsm/nodes/core/AttributeNode.js +7 -1
- package/examples/jsm/nodes/core/CacheNode.js +4 -1
- package/examples/jsm/nodes/core/ConstNode.js +1 -1
- package/examples/jsm/nodes/core/LightingModel.js +3 -1
- package/examples/jsm/nodes/core/Node.js +13 -15
- package/examples/jsm/nodes/core/NodeBuilder.js +209 -42
- package/examples/jsm/nodes/core/NodeFrame.js +10 -8
- package/examples/jsm/nodes/core/NodeUniform.js +12 -0
- package/examples/jsm/nodes/core/NodeUtils.js +7 -9
- package/examples/jsm/nodes/core/OutputStructNode.js +4 -4
- package/examples/jsm/nodes/core/ParameterNode.js +33 -0
- package/examples/jsm/nodes/core/PropertyNode.js +15 -6
- package/examples/jsm/nodes/core/StackNode.js +7 -17
- package/examples/jsm/nodes/core/StructTypeNode.js +4 -4
- package/examples/jsm/nodes/core/TempNode.js +1 -1
- package/examples/jsm/nodes/core/UniformGroup.js +13 -0
- package/examples/jsm/nodes/core/UniformGroupNode.js +36 -0
- package/examples/jsm/nodes/core/UniformNode.js +17 -0
- package/examples/jsm/nodes/core/VarNode.js +7 -34
- package/examples/jsm/nodes/core/VaryingNode.js +3 -7
- package/examples/jsm/nodes/display/BumpMapNode.js +35 -13
- package/examples/jsm/nodes/display/ColorAdjustmentNode.js +6 -10
- package/examples/jsm/nodes/display/GaussianBlurNode.js +170 -0
- package/examples/jsm/nodes/display/NormalMapNode.js +3 -1
- package/examples/jsm/nodes/display/PassNode.js +182 -0
- package/examples/jsm/nodes/display/ViewportDepthNode.js +31 -3
- package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +2 -2
- package/examples/jsm/nodes/display/ViewportNode.js +17 -10
- package/examples/jsm/nodes/functions/BSDF/BRDF_Sheen.js +20 -6
- package/examples/jsm/nodes/functions/BSDF/DFGApprox.js +8 -7
- package/examples/jsm/nodes/functions/BSDF/D_GGX.js +8 -3
- package/examples/jsm/nodes/functions/BSDF/Schlick_to_F0.js +8 -0
- package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +8 -0
- package/examples/jsm/nodes/functions/PhysicalLightingModel.js +93 -43
- package/examples/jsm/nodes/gpgpu/ComputeNode.js +2 -2
- package/examples/jsm/nodes/lighting/AmbientLightNode.js +1 -1
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +55 -6
- package/examples/jsm/nodes/lighting/DirectionalLightNode.js +1 -1
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +8 -18
- package/examples/jsm/nodes/lighting/LightingContextNode.js +21 -57
- package/examples/jsm/nodes/lighting/LightsNode.js +80 -20
- package/examples/jsm/nodes/lighting/PointLightNode.js +1 -1
- package/examples/jsm/nodes/lighting/SpotLightNode.js +1 -1
- package/examples/jsm/nodes/materials/InstancedPointsNodeMaterial.js +162 -0
- package/examples/jsm/nodes/materials/Line2NodeMaterial.js +76 -77
- package/examples/jsm/nodes/materials/LineDashedNodeMaterial.js +5 -5
- package/examples/jsm/nodes/materials/Materials.js +1 -0
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +1 -0
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +3 -3
- package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +3 -3
- package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +47 -20
- package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +6 -6
- package/examples/jsm/nodes/materials/NodeMaterial.js +82 -60
- package/examples/jsm/nodes/materials/PointsNodeMaterial.js +0 -10
- package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +0 -7
- package/examples/jsm/nodes/materialx/MaterialXNodes.js +10 -10
- package/examples/jsm/nodes/materialx/lib/mx_hsv.js +128 -54
- package/examples/jsm/nodes/materialx/lib/mx_noise.js +1430 -618
- package/examples/jsm/nodes/materialx/lib/mx_transform_color.js +24 -14
- package/examples/jsm/nodes/math/MathNode.js +2 -0
- package/examples/jsm/nodes/math/OperatorNode.js +24 -27
- package/examples/jsm/nodes/shadernode/ShaderNode.js +158 -10
- package/examples/jsm/nodes/utils/ArrayElementNode.js +2 -0
- package/examples/jsm/nodes/utils/DiscardNode.js +3 -2
- package/examples/jsm/nodes/utils/FunctionOverloadingNode.js +95 -0
- package/examples/jsm/nodes/utils/JoinNode.js +11 -1
- package/examples/jsm/nodes/utils/LoopNode.js +36 -24
- package/examples/jsm/nodes/utils/RemapNode.js +2 -2
- package/examples/jsm/nodes/utils/SplitNode.js +10 -2
- package/examples/jsm/nodes/utils/TriplanarTexturesNode.js +3 -3
- package/examples/jsm/objects/InstancedPoints.js +21 -0
- package/examples/jsm/objects/Lensflare.js +20 -0
- package/examples/jsm/objects/QuadMesh.js +60 -0
- package/examples/jsm/objects/ReflectorForSSRPass.js +3 -0
- package/examples/jsm/objects/Refractor.js +3 -0
- package/examples/jsm/objects/Sky.js +5 -3
- package/examples/jsm/objects/Water.js +5 -2
- package/examples/jsm/objects/Water2.js +3 -0
- package/examples/jsm/physics/AmmoPhysics.js +21 -0
- package/examples/jsm/physics/RapierPhysics.js +21 -0
- package/examples/jsm/postprocessing/BokehPass.js +3 -2
- package/examples/jsm/postprocessing/GTAOPass.js +572 -0
- package/examples/jsm/postprocessing/LUTPass.js +2 -1
- package/examples/jsm/postprocessing/OutputPass.js +3 -0
- package/examples/jsm/postprocessing/Pass.js +14 -3
- package/examples/jsm/postprocessing/SAOPass.js +0 -1
- package/examples/jsm/postprocessing/SMAAPass.js +0 -2
- package/examples/jsm/postprocessing/TAARenderPass.js +1 -2
- package/examples/jsm/renderers/CSS3DRenderer.js +3 -9
- package/examples/jsm/renderers/SVGRenderer.js +9 -6
- package/examples/jsm/renderers/common/Animation.js +10 -21
- package/examples/jsm/renderers/common/Backend.js +19 -3
- package/examples/jsm/renderers/common/Background.js +20 -22
- package/examples/jsm/renderers/common/Bindings.js +31 -22
- package/examples/jsm/renderers/common/ChainMap.js +3 -3
- package/examples/jsm/renderers/common/Color4.js +37 -0
- package/examples/jsm/renderers/common/Geometries.js +4 -4
- package/examples/jsm/renderers/common/Info.js +12 -2
- package/examples/jsm/renderers/common/Pipelines.js +3 -51
- package/examples/jsm/renderers/common/PostProcessing.js +25 -0
- package/examples/jsm/renderers/common/RenderContext.js +1 -1
- package/examples/jsm/renderers/common/RenderContexts.js +1 -1
- package/examples/jsm/renderers/common/RenderObject.js +21 -2
- package/examples/jsm/renderers/common/RenderObjects.js +5 -3
- package/examples/jsm/renderers/common/Renderer.js +137 -37
- package/examples/jsm/renderers/common/StorageTexture.js +1 -0
- package/examples/jsm/renderers/common/Textures.js +8 -37
- package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +10 -2
- package/examples/jsm/renderers/common/nodes/NodeUniformsGroup.js +44 -0
- package/examples/jsm/renderers/common/nodes/Nodes.js +121 -19
- package/examples/jsm/renderers/webgl/WebGLBackend.js +366 -67
- package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +183 -38
- package/examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js +92 -5
- package/examples/jsm/renderers/webgl/utils/WebGLCapabilities.js +36 -0
- package/examples/jsm/renderers/webgl/utils/WebGLExtensions.js +11 -1
- package/examples/jsm/renderers/webgl/utils/WebGLState.js +14 -2
- package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +71 -2
- package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +42 -0
- package/examples/jsm/renderers/webgl-legacy/nodes/SlotNode.js +1 -1
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +33 -3
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.js +4 -14
- package/examples/jsm/renderers/webgpu/WebGPUBackend.js +188 -137
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +1 -1
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +241 -90
- package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +15 -10
- package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +11 -3
- package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +2 -3
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +88 -6
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +2 -0
- package/examples/jsm/shaders/AfterimageShader.js +2 -0
- package/examples/jsm/shaders/BasicShader.js +2 -0
- package/examples/jsm/shaders/BlendShader.js +2 -0
- package/examples/jsm/shaders/BokehShader.js +2 -0
- package/examples/jsm/shaders/BokehShader2.js +4 -0
- package/examples/jsm/shaders/BrightnessContrastShader.js +2 -0
- package/examples/jsm/shaders/ColorCorrectionShader.js +2 -0
- package/examples/jsm/shaders/DOFMipMapShader.js +2 -0
- package/examples/jsm/shaders/DepthLimitedBlurShader.js +5 -0
- package/examples/jsm/shaders/FXAAShader.js +135 -133
- package/examples/jsm/shaders/FilmShader.js +1 -1
- package/examples/jsm/shaders/FocusShader.js +2 -0
- package/examples/jsm/shaders/FreiChenShader.js +2 -0
- package/examples/jsm/shaders/GTAOShader.js +424 -0
- package/examples/jsm/shaders/GodRaysShader.js +8 -0
- package/examples/jsm/shaders/HalftoneShader.js +2 -0
- package/examples/jsm/shaders/HorizontalTiltShiftShader.js +2 -0
- package/examples/jsm/shaders/HueSaturationShader.js +2 -0
- package/examples/jsm/shaders/KaleidoShader.js +2 -0
- package/examples/jsm/shaders/LuminosityHighPassShader.js +2 -0
- package/examples/jsm/shaders/LuminosityShader.js +2 -0
- package/examples/jsm/shaders/MMDToonShader.js +2 -0
- package/examples/jsm/shaders/MirrorShader.js +2 -0
- package/examples/jsm/shaders/NormalMapShader.js +2 -0
- package/examples/jsm/shaders/OutputShader.js +8 -5
- package/examples/jsm/shaders/PoissonDenoiseShader.js +226 -0
- package/examples/jsm/shaders/SAOShader.js +7 -3
- package/examples/jsm/shaders/SMAAShader.js +6 -0
- package/examples/jsm/shaders/SSAOShader.js +8 -3
- package/examples/jsm/shaders/SSRShader.js +6 -0
- package/examples/jsm/shaders/SobelOperatorShader.js +2 -0
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +2 -0
- package/examples/jsm/shaders/TechnicolorShader.js +2 -0
- package/examples/jsm/shaders/TriangleBlurShader.js +2 -0
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +2 -0
- package/examples/jsm/shaders/VelocityShader.js +2 -0
- package/examples/jsm/shaders/VerticalTiltShiftShader.js +2 -0
- package/examples/jsm/shaders/WaterRefractionShader.js +2 -0
- package/examples/jsm/transpiler/AST.js +270 -0
- package/examples/jsm/transpiler/GLSLDecoder.js +941 -0
- package/examples/jsm/transpiler/ShaderToyDecoder.js +49 -0
- package/examples/jsm/transpiler/TSLEncoder.js +715 -0
- package/examples/jsm/transpiler/Transpiler.js +18 -0
- package/examples/jsm/utils/SortUtils.js +158 -0
- package/examples/jsm/utils/TextureUtils.js +33 -21
- package/examples/jsm/webxr/ARButton.js +14 -0
- package/examples/jsm/webxr/VRButton.js +24 -9
- package/examples/jsm/webxr/XRButton.js +27 -11
- package/examples/jsm/webxr/XREstimatedLight.js +1 -1
- package/package.json +8 -6
- package/src/Three.js +1 -0
- package/src/constants.js +8 -1
- package/src/core/BufferAttribute.js +21 -2
- package/src/core/InterleavedBuffer.js +21 -1
- package/src/core/Object3D.js +60 -12
- package/src/core/UniformsGroup.js +7 -1
- package/src/extras/PMREMGenerator.js +7 -1
- package/src/extras/curves/LineCurve3.js +4 -0
- package/src/loaders/AudioLoader.js +1 -1
- package/src/loaders/BufferGeometryLoader.js +0 -7
- package/src/loaders/ImageBitmapLoader.js +25 -1
- package/src/loaders/MaterialLoader.js +10 -2
- package/src/loaders/ObjectLoader.js +49 -0
- package/src/materials/Material.js +27 -13
- package/src/materials/ShaderMaterial.js +2 -1
- package/src/math/Box3.js +35 -18
- package/src/math/ColorManagement.js +0 -16
- package/src/math/Quaternion.js +5 -4
- package/src/math/Sphere.js +2 -0
- package/src/math/Triangle.js +17 -5
- package/src/math/Vector3.js +11 -12
- package/src/objects/BatchedMesh.js +1020 -0
- package/src/objects/Skeleton.js +1 -3
- package/src/objects/SkinnedMesh.js +6 -7
- package/src/renderers/WebGL3DRenderTarget.js +2 -2
- package/src/renderers/WebGLArrayRenderTarget.js +2 -2
- package/src/renderers/WebGLRenderer.js +165 -43
- package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +19 -0
- package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +3 -2
- package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +0 -5
- package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +31 -4
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +9 -4
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +8 -6
- package/src/renderers/shaders/ShaderChunk/project_vertex.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.js +9 -17
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +84 -0
- package/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk.js +4 -0
- 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/meshbasic.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +3 -0
- package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +4 -2
- package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/shadow.glsl.js +3 -0
- package/src/renderers/webgl/WebGLAttributes.js +39 -5
- package/src/renderers/webgl/WebGLBufferRenderer.js +31 -0
- package/src/renderers/webgl/WebGLCubeMaps.js +1 -1
- package/src/renderers/webgl/WebGLExtensions.js +1 -0
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +31 -0
- package/src/renderers/webgl/WebGLLights.js +11 -2
- package/src/renderers/webgl/WebGLProgram.js +100 -51
- package/src/renderers/webgl/WebGLPrograms.js +8 -0
- package/src/renderers/webgl/WebGLShadowMap.js +35 -0
- package/src/renderers/webgl/WebGLState.js +25 -4
- package/src/renderers/webgl/WebGLTextures.js +7 -11
- package/src/renderers/webgl/WebGLUniforms.js +11 -1
- package/src/renderers/webgl/WebGLUniformsGroups.js +72 -93
- package/src/renderers/webxr/WebXRManager.js +16 -0
- package/examples/jsm/nodes/accessors/ExtendedMaterialNode.js +0 -76
- package/examples/jsm/nodes/accessors/LineMaterialNode.js +0 -29
|
@@ -11,27 +11,89 @@ import { Capsule } from '../math/Capsule.js';
|
|
|
11
11
|
|
|
12
12
|
const _v1 = new Vector3();
|
|
13
13
|
const _v2 = new Vector3();
|
|
14
|
+
const _point1 = new Vector3();
|
|
15
|
+
const _point2 = new Vector3();
|
|
14
16
|
const _plane = new Plane();
|
|
15
17
|
const _line1 = new Line3();
|
|
16
18
|
const _line2 = new Line3();
|
|
17
19
|
const _sphere = new Sphere();
|
|
18
20
|
const _capsule = new Capsule();
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
const _temp1 = new Vector3();
|
|
23
|
+
const _temp2 = new Vector3();
|
|
24
|
+
const _temp3 = new Vector3();
|
|
25
|
+
const EPS = 1e-10;
|
|
26
|
+
|
|
27
|
+
function lineToLineClosestPoints( line1, line2, target1 = null, target2 = null ) {
|
|
28
|
+
|
|
29
|
+
const r = _temp1.copy( line1.end ).sub( line1.start );
|
|
30
|
+
const s = _temp2.copy( line2.end ).sub( line2.start );
|
|
31
|
+
const w = _temp3.copy( line2.start ).sub( line1.start );
|
|
32
|
+
|
|
33
|
+
const a = r.dot( s ),
|
|
34
|
+
b = r.dot( r ),
|
|
35
|
+
c = s.dot( s ),
|
|
36
|
+
d = s.dot( w ),
|
|
37
|
+
e = r.dot( w );
|
|
38
|
+
|
|
39
|
+
let t1, t2;
|
|
40
|
+
const divisor = b * c - a * a;
|
|
41
|
+
|
|
42
|
+
if ( Math.abs( divisor ) < EPS ) {
|
|
43
|
+
|
|
44
|
+
const d1 = - d / c;
|
|
45
|
+
const d2 = ( a - d ) / c;
|
|
46
|
+
|
|
47
|
+
if ( Math.abs( d1 - 0.5 ) < Math.abs( d2 - 0.5 ) ) {
|
|
48
|
+
|
|
49
|
+
t1 = 0;
|
|
50
|
+
t2 = d1;
|
|
51
|
+
|
|
52
|
+
} else {
|
|
53
|
+
|
|
54
|
+
t1 = 1;
|
|
55
|
+
t2 = d2;
|
|
56
|
+
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
} else {
|
|
60
|
+
|
|
61
|
+
t1 = ( d * a + e * c ) / divisor;
|
|
62
|
+
t2 = ( t1 * a - d ) / c;
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
t2 = Math.max( 0, Math.min( 1, t2 ) );
|
|
67
|
+
t1 = Math.max( 0, Math.min( 1, t1 ) );
|
|
68
|
+
|
|
69
|
+
if ( target1 ) {
|
|
70
|
+
|
|
71
|
+
target1.copy( r ).multiplyScalar( t1 ).add( line1.start );
|
|
21
72
|
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if ( target2 ) {
|
|
76
|
+
|
|
77
|
+
target2.copy( s ).multiplyScalar( t2 ).add( line2.start );
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
class Octree {
|
|
22
84
|
|
|
23
85
|
constructor( box ) {
|
|
24
86
|
|
|
25
|
-
this.triangles = [];
|
|
26
87
|
this.box = box;
|
|
88
|
+
this.bounds = new Box3();
|
|
89
|
+
|
|
27
90
|
this.subTrees = [];
|
|
91
|
+
this.triangles = [];
|
|
28
92
|
|
|
29
93
|
}
|
|
30
94
|
|
|
31
95
|
addTriangle( triangle ) {
|
|
32
96
|
|
|
33
|
-
if ( ! this.bounds ) this.bounds = new Box3();
|
|
34
|
-
|
|
35
97
|
this.bounds.min.x = Math.min( this.bounds.min.x, triangle.a.x, triangle.b.x, triangle.c.x );
|
|
36
98
|
this.bounds.min.y = Math.min( this.bounds.min.y, triangle.a.y, triangle.b.y, triangle.c.y );
|
|
37
99
|
this.bounds.min.z = Math.min( this.bounds.min.z, triangle.a.z, triangle.b.z, triangle.c.z );
|
|
@@ -195,11 +257,15 @@ class Octree {
|
|
|
195
257
|
|
|
196
258
|
const line2 = _line2.set( lines[ i ][ 0 ], lines[ i ][ 1 ] );
|
|
197
259
|
|
|
198
|
-
|
|
260
|
+
lineToLineClosestPoints( line1, line2, _point1, _point2 );
|
|
199
261
|
|
|
200
|
-
if (
|
|
262
|
+
if ( _point1.distanceToSquared( _point2 ) < r2 ) {
|
|
201
263
|
|
|
202
|
-
return {
|
|
264
|
+
return {
|
|
265
|
+
normal: _point1.clone().sub( _point2 ).normalize(),
|
|
266
|
+
point: _point2.clone(),
|
|
267
|
+
depth: capsule.radius - _point1.distanceTo( _point2 )
|
|
268
|
+
};
|
|
203
269
|
|
|
204
270
|
}
|
|
205
271
|
|
|
@@ -457,6 +523,18 @@ class Octree {
|
|
|
457
523
|
|
|
458
524
|
}
|
|
459
525
|
|
|
526
|
+
clear() {
|
|
527
|
+
|
|
528
|
+
this.box = null;
|
|
529
|
+
this.bounds.makeEmpty();
|
|
530
|
+
|
|
531
|
+
this.subTrees.length = 0;
|
|
532
|
+
this.triangles.length = 0;
|
|
533
|
+
|
|
534
|
+
return this;
|
|
535
|
+
|
|
536
|
+
}
|
|
537
|
+
|
|
460
538
|
}
|
|
461
539
|
|
|
462
540
|
export { Octree };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
class Timer {
|
|
2
|
+
|
|
3
|
+
constructor() {
|
|
4
|
+
|
|
5
|
+
this._previousTime = 0;
|
|
6
|
+
this._currentTime = 0;
|
|
7
|
+
this._startTime = now();
|
|
8
|
+
|
|
9
|
+
this._delta = 0;
|
|
10
|
+
this._elapsed = 0;
|
|
11
|
+
|
|
12
|
+
this._timescale = 1;
|
|
13
|
+
|
|
14
|
+
// use Page Visibility API to avoid large time delta values
|
|
15
|
+
|
|
16
|
+
this._usePageVisibilityAPI = ( typeof document !== 'undefined' && document.hidden !== undefined );
|
|
17
|
+
|
|
18
|
+
if ( this._usePageVisibilityAPI === true ) {
|
|
19
|
+
|
|
20
|
+
this._pageVisibilityHandler = handleVisibilityChange.bind( this );
|
|
21
|
+
|
|
22
|
+
document.addEventListener( 'visibilitychange', this._pageVisibilityHandler, false );
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
getDelta() {
|
|
29
|
+
|
|
30
|
+
return this._delta / 1000;
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
getElapsed() {
|
|
35
|
+
|
|
36
|
+
return this._elapsed / 1000;
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
getTimescale() {
|
|
41
|
+
|
|
42
|
+
return this._timescale;
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
setTimescale( timescale ) {
|
|
47
|
+
|
|
48
|
+
this._timescale = timescale;
|
|
49
|
+
|
|
50
|
+
return this;
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
reset() {
|
|
55
|
+
|
|
56
|
+
this._currentTime = now() - this._startTime;
|
|
57
|
+
|
|
58
|
+
return this;
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
dispose() {
|
|
63
|
+
|
|
64
|
+
if ( this._usePageVisibilityAPI === true ) {
|
|
65
|
+
|
|
66
|
+
document.removeEventListener( 'visibilitychange', this._pageVisibilityHandler );
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return this;
|
|
71
|
+
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
update( timestamp ) {
|
|
75
|
+
|
|
76
|
+
this._previousTime = this._currentTime;
|
|
77
|
+
this._currentTime = ( timestamp !== undefined ? timestamp : now() ) - this._startTime;
|
|
78
|
+
|
|
79
|
+
this._delta = ( this._currentTime - this._previousTime ) * this._timescale;
|
|
80
|
+
this._elapsed += this._delta; // _elapsed is the accumulation of all previous deltas
|
|
81
|
+
|
|
82
|
+
return this;
|
|
83
|
+
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
class FixedTimer extends Timer {
|
|
89
|
+
|
|
90
|
+
constructor( fps = 60 ) {
|
|
91
|
+
|
|
92
|
+
super();
|
|
93
|
+
this._delta = ( 1 / fps ) * 1000;
|
|
94
|
+
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
update() {
|
|
98
|
+
|
|
99
|
+
this._elapsed += ( this._delta * this._timescale ); // _elapsed is the accumulation of all previous deltas
|
|
100
|
+
|
|
101
|
+
return this;
|
|
102
|
+
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function now() {
|
|
108
|
+
|
|
109
|
+
return ( typeof performance === 'undefined' ? Date : performance ).now();
|
|
110
|
+
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function handleVisibilityChange() {
|
|
114
|
+
|
|
115
|
+
if ( document.hidden === false ) this.reset();
|
|
116
|
+
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export { Timer, FixedTimer };
|
|
@@ -176,16 +176,13 @@ function TubePainter() {
|
|
|
176
176
|
|
|
177
177
|
if ( start === end ) return;
|
|
178
178
|
|
|
179
|
-
positions.
|
|
180
|
-
positions.updateRange.count = ( end - start ) * 3;
|
|
179
|
+
positions.addUpdateRange( start * 3, ( end - start ) * 3 );
|
|
181
180
|
positions.needsUpdate = true;
|
|
182
181
|
|
|
183
|
-
normals.
|
|
184
|
-
normals.updateRange.count = ( end - start ) * 3;
|
|
182
|
+
normals.addUpdateRange( start * 3, ( end - start ) * 3 );
|
|
185
183
|
normals.needsUpdate = true;
|
|
186
184
|
|
|
187
|
-
colors.
|
|
188
|
-
colors.updateRange.count = ( end - start ) * 3;
|
|
185
|
+
colors.addUpdateRange( start * 3, ( end - start ) * 3 );
|
|
189
186
|
colors.needsUpdate = true;
|
|
190
187
|
|
|
191
188
|
count = geometry.drawRange.count;
|
|
@@ -214,8 +214,26 @@ export class Flow {
|
|
|
214
214
|
child instanceof InstancedMesh
|
|
215
215
|
) {
|
|
216
216
|
|
|
217
|
-
|
|
218
|
-
|
|
217
|
+
if ( Array.isArray( child.material ) ) {
|
|
218
|
+
|
|
219
|
+
const materials = [];
|
|
220
|
+
|
|
221
|
+
for ( const material of child.material ) {
|
|
222
|
+
|
|
223
|
+
const newMaterial = material.clone();
|
|
224
|
+
modifyShader( newMaterial, uniforms, numberOfCurves );
|
|
225
|
+
materials.push( newMaterial );
|
|
226
|
+
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
child.material = materials;
|
|
230
|
+
|
|
231
|
+
} else {
|
|
232
|
+
|
|
233
|
+
child.material = child.material.clone();
|
|
234
|
+
modifyShader( child.material, uniforms, numberOfCurves );
|
|
235
|
+
|
|
236
|
+
}
|
|
219
237
|
|
|
220
238
|
}
|
|
221
239
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BufferGeometry,
|
|
3
3
|
Float32BufferAttribute,
|
|
4
|
-
|
|
4
|
+
Vector2,
|
|
5
|
+
Vector3,
|
|
6
|
+
Vector4
|
|
5
7
|
} from 'three';
|
|
6
8
|
import * as BufferGeometryUtils from '../utils/BufferGeometryUtils.js';
|
|
7
9
|
|
|
@@ -20,13 +22,17 @@ class SimplifyModifier {
|
|
|
20
22
|
modify( geometry, count ) {
|
|
21
23
|
|
|
22
24
|
geometry = geometry.clone();
|
|
25
|
+
|
|
26
|
+
// currently morphAttributes are not supported
|
|
27
|
+
delete geometry.morphAttributes.position;
|
|
28
|
+
delete geometry.morphAttributes.normal;
|
|
23
29
|
const attributes = geometry.attributes;
|
|
24
30
|
|
|
25
|
-
// this modifier can only process indexed and non-indexed geomtries with a position attribute
|
|
31
|
+
// this modifier can only process indexed and non-indexed geomtries with at least a position attribute
|
|
26
32
|
|
|
27
33
|
for ( const name in attributes ) {
|
|
28
34
|
|
|
29
|
-
if ( name !== 'position' ) geometry.deleteAttribute( name );
|
|
35
|
+
if ( name !== 'position' && name !== 'uv' && name !== 'normal' && name !== 'tangent' && name !== 'color' ) geometry.deleteAttribute( name );
|
|
30
36
|
|
|
31
37
|
}
|
|
32
38
|
|
|
@@ -42,12 +48,44 @@ class SimplifyModifier {
|
|
|
42
48
|
// add vertices
|
|
43
49
|
|
|
44
50
|
const positionAttribute = geometry.getAttribute( 'position' );
|
|
51
|
+
const uvAttribute = geometry.getAttribute( 'uv' );
|
|
52
|
+
const normalAttribute = geometry.getAttribute( 'normal' );
|
|
53
|
+
const tangentAttribute = geometry.getAttribute( 'tangent' );
|
|
54
|
+
const colorAttribute = geometry.getAttribute( 'color' );
|
|
55
|
+
|
|
56
|
+
let t = null;
|
|
57
|
+
let v2 = null;
|
|
58
|
+
let nor = null;
|
|
59
|
+
let col = null;
|
|
45
60
|
|
|
46
61
|
for ( let i = 0; i < positionAttribute.count; i ++ ) {
|
|
47
62
|
|
|
48
63
|
const v = new Vector3().fromBufferAttribute( positionAttribute, i );
|
|
64
|
+
if ( uvAttribute ) {
|
|
65
|
+
|
|
66
|
+
v2 = new Vector2().fromBufferAttribute( uvAttribute, i );
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if ( normalAttribute ) {
|
|
71
|
+
|
|
72
|
+
nor = new Vector3().fromBufferAttribute( normalAttribute, i );
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if ( tangentAttribute ) {
|
|
77
|
+
|
|
78
|
+
t = new Vector4().fromBufferAttribute( tangentAttribute, i );
|
|
79
|
+
|
|
80
|
+
}
|
|
49
81
|
|
|
50
|
-
|
|
82
|
+
if ( colorAttribute ) {
|
|
83
|
+
|
|
84
|
+
col = new THREE.Color().fromBufferAttribute( colorAttribute, i );
|
|
85
|
+
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const vertex = new Vertex( v, v2, nor, t, col );
|
|
51
89
|
vertices.push( vertex );
|
|
52
90
|
|
|
53
91
|
}
|
|
@@ -115,6 +153,10 @@ class SimplifyModifier {
|
|
|
115
153
|
|
|
116
154
|
const simplifiedGeometry = new BufferGeometry();
|
|
117
155
|
const position = [];
|
|
156
|
+
const uv = [];
|
|
157
|
+
const normal = [];
|
|
158
|
+
const tangent = [];
|
|
159
|
+
const color = [];
|
|
118
160
|
|
|
119
161
|
index = [];
|
|
120
162
|
|
|
@@ -122,10 +164,35 @@ class SimplifyModifier {
|
|
|
122
164
|
|
|
123
165
|
for ( let i = 0; i < vertices.length; i ++ ) {
|
|
124
166
|
|
|
125
|
-
const vertex = vertices[ i ]
|
|
126
|
-
position.push( vertex.x, vertex.y, vertex.z );
|
|
167
|
+
const vertex = vertices[ i ];
|
|
168
|
+
position.push( vertex.position.x, vertex.position.y, vertex.position.z );
|
|
169
|
+
if ( vertex.uv ) {
|
|
170
|
+
|
|
171
|
+
uv.push( vertex.uv.x, vertex.uv.y );
|
|
172
|
+
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if ( vertex.normal ) {
|
|
176
|
+
|
|
177
|
+
normal.push( vertex.normal.x, vertex.normal.y, vertex.normal.z );
|
|
178
|
+
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if ( vertex.tangent ) {
|
|
182
|
+
|
|
183
|
+
tangent.push( vertex.tangent.x, vertex.tangent.y, vertex.tangent.z, vertex.tangent.w );
|
|
184
|
+
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if ( vertex.color ) {
|
|
188
|
+
|
|
189
|
+
color.push( vertex.color.r, vertex.color.g, vertex.color.b );
|
|
190
|
+
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
|
|
127
194
|
// cache final index to GREATLY speed up faces reconstruction
|
|
128
|
-
|
|
195
|
+
vertex.id = i;
|
|
129
196
|
|
|
130
197
|
}
|
|
131
198
|
|
|
@@ -138,9 +205,12 @@ class SimplifyModifier {
|
|
|
138
205
|
|
|
139
206
|
}
|
|
140
207
|
|
|
141
|
-
//
|
|
142
|
-
|
|
143
208
|
simplifiedGeometry.setAttribute( 'position', new Float32BufferAttribute( position, 3 ) );
|
|
209
|
+
if ( uv.length > 0 ) simplifiedGeometry.setAttribute( 'uv', new Float32BufferAttribute( uv, 2 ) );
|
|
210
|
+
if ( normal.length > 0 ) simplifiedGeometry.setAttribute( 'normal', new Float32BufferAttribute( normal, 3 ) );
|
|
211
|
+
if ( tangent.length > 0 ) simplifiedGeometry.setAttribute( 'tangent', new Float32BufferAttribute( tangent, 4 ) );
|
|
212
|
+
if ( color.length > 0 ) simplifiedGeometry.setAttribute( 'color', new Float32BufferAttribute( color, 3 ) );
|
|
213
|
+
|
|
144
214
|
simplifiedGeometry.setIndex( index );
|
|
145
215
|
|
|
146
216
|
return simplifiedGeometry;
|
|
@@ -318,7 +388,7 @@ function removeFace( f, faces ) {
|
|
|
318
388
|
|
|
319
389
|
}
|
|
320
390
|
|
|
321
|
-
function collapse( vertices, faces, u, v ) {
|
|
391
|
+
function collapse( vertices, faces, u, v ) {
|
|
322
392
|
|
|
323
393
|
// Collapse the edge uv by moving vertex u onto v
|
|
324
394
|
|
|
@@ -330,6 +400,24 @@ function collapse( vertices, faces, u, v ) { // u and v are pointers to vertices
|
|
|
330
400
|
|
|
331
401
|
}
|
|
332
402
|
|
|
403
|
+
if ( v.uv ) {
|
|
404
|
+
|
|
405
|
+
u.uv.copy( v.uv );
|
|
406
|
+
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
if ( v.normal ) {
|
|
410
|
+
|
|
411
|
+
v.normal.add( u.normal ).normalize();
|
|
412
|
+
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
if ( v.tangent ) {
|
|
416
|
+
|
|
417
|
+
v.tangent.add( u.tangent ).normalize();
|
|
418
|
+
|
|
419
|
+
}
|
|
420
|
+
|
|
333
421
|
const tmpVertices = [];
|
|
334
422
|
|
|
335
423
|
for ( let i = 0; i < u.neighbors.length; i ++ ) {
|
|
@@ -480,9 +568,13 @@ class Triangle {
|
|
|
480
568
|
|
|
481
569
|
class Vertex {
|
|
482
570
|
|
|
483
|
-
constructor( v ) {
|
|
571
|
+
constructor( v, uv, normal, tangent, color ) {
|
|
484
572
|
|
|
485
573
|
this.position = v;
|
|
574
|
+
this.uv = uv;
|
|
575
|
+
this.normal = normal;
|
|
576
|
+
this.tangent = tangent;
|
|
577
|
+
this.color = color;
|
|
486
578
|
|
|
487
579
|
this.id = - 1; // external use position in vertices list (for e.g. face generation)
|
|
488
580
|
|
|
@@ -111,9 +111,9 @@ class TessellateModifier {
|
|
|
111
111
|
const c2 = cs[ b ];
|
|
112
112
|
const c3 = cs[ c ];
|
|
113
113
|
|
|
114
|
-
colors2.push( c1.
|
|
115
|
-
colors2.push( c2.
|
|
116
|
-
colors2.push( c3.
|
|
114
|
+
colors2.push( c1.r, c1.g, c1.b );
|
|
115
|
+
colors2.push( c2.r, c2.g, c2.b );
|
|
116
|
+
colors2.push( c3.r, c3.g, c3.b );
|
|
117
117
|
|
|
118
118
|
}
|
|
119
119
|
|
|
@@ -6,6 +6,7 @@ export * from './core/constants.js';
|
|
|
6
6
|
|
|
7
7
|
// core
|
|
8
8
|
export { default as ArrayUniformNode /* @TODO: arrayUniform */ } from './core/ArrayUniformNode.js';
|
|
9
|
+
export { default as AssignNode, assign } from './core/AssignNode.js';
|
|
9
10
|
export { default as AttributeNode, attribute } from './core/AttributeNode.js';
|
|
10
11
|
export { default as BypassNode, bypass } from './core/BypassNode.js';
|
|
11
12
|
export { default as CacheNode, cache } from './core/CacheNode.js';
|
|
@@ -14,6 +15,7 @@ export { default as ContextNode, context, label } from './core/ContextNode.js';
|
|
|
14
15
|
export { default as IndexNode, vertexIndex, instanceIndex } from './core/IndexNode.js';
|
|
15
16
|
export { default as LightingModel } from './core/LightingModel.js';
|
|
16
17
|
export { default as Node, addNodeClass, createNodeFromType } from './core/Node.js';
|
|
18
|
+
export { default as VarNode, temp } from './core/VarNode.js';
|
|
17
19
|
export { default as NodeAttribute } from './core/NodeAttribute.js';
|
|
18
20
|
export { default as NodeBuilder } from './core/NodeBuilder.js';
|
|
19
21
|
export { default as NodeCache } from './core/NodeCache.js';
|
|
@@ -24,11 +26,12 @@ export { default as NodeKeywords } from './core/NodeKeywords.js';
|
|
|
24
26
|
export { default as NodeUniform } from './core/NodeUniform.js';
|
|
25
27
|
export { default as NodeVar } from './core/NodeVar.js';
|
|
26
28
|
export { default as NodeVarying } from './core/NodeVarying.js';
|
|
27
|
-
export { default as
|
|
29
|
+
export { default as ParameterNode, parameter } from './core/ParameterNode.js';
|
|
30
|
+
export { default as PropertyNode, property, varyingProperty, output, diffuseColor, roughness, metalness, clearcoat, clearcoatRoughness, sheen, sheenRoughness, iridescence, iridescenceIOR, iridescenceThickness, specularColor, shininess, dashSize, gapSize, pointWidth } from './core/PropertyNode.js';
|
|
28
31
|
export { default as StackNode, stack } from './core/StackNode.js';
|
|
29
32
|
export { default as TempNode } from './core/TempNode.js';
|
|
33
|
+
export { default as UniformGroupNode, uniformGroup, objectGroup, renderGroup, frameGroup } from './core/UniformGroupNode.js';
|
|
30
34
|
export { default as UniformNode, uniform } from './core/UniformNode.js';
|
|
31
|
-
export { default as VarNode, temp } from './core/VarNode.js';
|
|
32
35
|
export { default as VaryingNode, varying } from './core/VaryingNode.js';
|
|
33
36
|
export { default as OutputStructNode, outputStruct } from './core/OutputStructNode.js';
|
|
34
37
|
|
|
@@ -36,8 +39,8 @@ import * as NodeUtils from './core/NodeUtils.js';
|
|
|
36
39
|
export { NodeUtils };
|
|
37
40
|
|
|
38
41
|
// math
|
|
39
|
-
export { default as MathNode, EPSILON, INFINITY, radians, degrees, exp, exp2, log, log2, sqrt, inverseSqrt, floor, ceil, normalize, fract, sin, cos, tan, asin, acos, atan, abs, sign, length, negate, oneMinus, dFdx, dFdy, round, reciprocal, trunc, fwidth, atan2, min, max, mod, step, reflect, distance, difference, dot, cross, pow, pow2, pow3, pow4, transformDirection, mix, clamp, saturate, refract, smoothstep, faceForward } from './math/MathNode.js';
|
|
40
|
-
export { default as OperatorNode, add, sub, mul, div, remainder, equal,
|
|
42
|
+
export { default as MathNode, EPSILON, INFINITY, radians, degrees, exp, exp2, log, log2, sqrt, inverseSqrt, floor, ceil, normalize, fract, sin, cos, tan, asin, acos, atan, abs, sign, length, negate, oneMinus, dFdx, dFdy, round, reciprocal, trunc, fwidth, bitcast, atan2, min, max, mod, step, reflect, distance, difference, dot, cross, pow, pow2, pow3, pow4, transformDirection, mix, clamp, saturate, refract, smoothstep, faceForward } from './math/MathNode.js';
|
|
43
|
+
export { default as OperatorNode, add, sub, mul, div, remainder, equal, lessThan, greaterThan, lessThanEqual, greaterThanEqual, and, or, xor, bitAnd, bitOr, bitXor, shiftLeft, shiftRight } from './math/OperatorNode.js';
|
|
41
44
|
export { default as CondNode, cond } from './math/CondNode.js';
|
|
42
45
|
export { default as HashNode, hash } from './math/HashNode.js';
|
|
43
46
|
|
|
@@ -46,6 +49,7 @@ export { default as ArrayElementNode } from './utils/ArrayElementNode.js';
|
|
|
46
49
|
export { default as ConvertNode } from './utils/ConvertNode.js';
|
|
47
50
|
export { default as DiscardNode, discard } from './utils/DiscardNode.js';
|
|
48
51
|
export { default as EquirectUVNode, equirectUV } from './utils/EquirectUVNode.js';
|
|
52
|
+
export { default as FunctionOverloadingNode, overloadingFn } from './utils/FunctionOverloadingNode.js';
|
|
49
53
|
export { default as JoinNode } from './utils/JoinNode.js';
|
|
50
54
|
export { default as LoopNode, loop } from './utils/LoopNode.js';
|
|
51
55
|
export { default as MatcapUVNode, matcapUV } from './utils/MatcapUVNode.js';
|
|
@@ -68,12 +72,10 @@ export * from './shadernode/ShaderNode.js';
|
|
|
68
72
|
export { default as BitangentNode, bitangentGeometry, bitangentLocal, bitangentView, bitangentWorld, transformedBitangentView, transformedBitangentWorld } from './accessors/BitangentNode.js';
|
|
69
73
|
export { default as BufferAttributeNode, bufferAttribute, dynamicBufferAttribute, instancedBufferAttribute, instancedDynamicBufferAttribute } from './accessors/BufferAttributeNode.js';
|
|
70
74
|
export { default as BufferNode, buffer } from './accessors/BufferNode.js';
|
|
71
|
-
export { default as CameraNode, cameraProjectionMatrix, cameraViewMatrix, cameraNormalMatrix, cameraWorldMatrix, cameraPosition, cameraNear, cameraFar } from './accessors/CameraNode.js';
|
|
75
|
+
export { default as CameraNode, cameraProjectionMatrix, cameraViewMatrix, cameraNormalMatrix, cameraWorldMatrix, cameraPosition, cameraNear, cameraFar, cameraLogDepth } from './accessors/CameraNode.js';
|
|
72
76
|
export { default as CubeTextureNode, cubeTexture } from './accessors/CubeTextureNode.js';
|
|
73
|
-
export { default as ExtendedMaterialNode, materialNormal } from './accessors/ExtendedMaterialNode.js';
|
|
74
77
|
export { default as InstanceNode, instance } from './accessors/InstanceNode.js';
|
|
75
|
-
export { default as
|
|
76
|
-
export { default as MaterialNode, materialAlphaTest, materialColor, materialShininess, materialEmissive, materialOpacity, materialSpecularColor, materialReflectivity, materialRoughness, materialMetalness, materialRotation, materialSheen, materialSheenRoughness } from './accessors/MaterialNode.js';
|
|
78
|
+
export { default as MaterialNode, materialAlphaTest, materialColor, materialShininess, materialEmissive, materialOpacity, materialSpecularColor, materialSpecularStrength, materialReflectivity, materialRoughness, materialMetalness, materialNormal, materialClearcoat, materialClearcoatRoughness, materialClearcoatNormal, materialRotation, materialSheen, materialSheenRoughness, materialIridescence, materialIridescenceIOR, materialIridescenceThickness, materialLineScale, materialLineDashSize, materialLineGapSize, materialLineWidth, materialLineDashOffset, materialPointWidth } from './accessors/MaterialNode.js';
|
|
77
79
|
export { default as MaterialReferenceNode, materialReference } from './accessors/MaterialReferenceNode.js';
|
|
78
80
|
export { default as MorphNode, morph } from './accessors/MorphNode.js';
|
|
79
81
|
export { default as TextureBicubicNode, textureBicubic } from './accessors/TextureBicubicNode.js';
|
|
@@ -83,13 +85,13 @@ export { default as NormalNode, normalGeometry, normalLocal, normalView, normalW
|
|
|
83
85
|
export { default as Object3DNode, objectDirection, objectViewMatrix, objectNormalMatrix, objectWorldMatrix, objectPosition, objectScale, objectViewPosition } from './accessors/Object3DNode.js';
|
|
84
86
|
export { default as PointUVNode, pointUV } from './accessors/PointUVNode.js';
|
|
85
87
|
export { default as PositionNode, positionGeometry, positionLocal, positionWorld, positionWorldDirection, positionView, positionViewDirection } from './accessors/PositionNode.js';
|
|
86
|
-
export { default as ReferenceNode, reference } from './accessors/ReferenceNode.js';
|
|
88
|
+
export { default as ReferenceNode, reference, referenceIndex } from './accessors/ReferenceNode.js';
|
|
87
89
|
export { default as ReflectVectorNode, reflectVector } from './accessors/ReflectVectorNode.js';
|
|
88
90
|
export { default as SkinningNode, skinning } from './accessors/SkinningNode.js';
|
|
89
91
|
export { default as SceneNode, backgroundBlurriness, backgroundIntensity } from './accessors/SceneNode.js';
|
|
90
92
|
export { default as StorageBufferNode, storage } from './accessors/StorageBufferNode.js';
|
|
91
93
|
export { default as TangentNode, tangentGeometry, tangentLocal, tangentView, tangentWorld, transformedTangentView, transformedTangentWorld } from './accessors/TangentNode.js';
|
|
92
|
-
export { default as TextureNode, texture, /*textureLevel,*/ sampler } from './accessors/TextureNode.js';
|
|
94
|
+
export { default as TextureNode, texture, textureLoad, /*textureLevel,*/ sampler } from './accessors/TextureNode.js';
|
|
93
95
|
export { default as TextureStoreNode, textureStore } from './accessors/TextureStoreNode.js';
|
|
94
96
|
export { default as UVNode, uv } from './accessors/UVNode.js';
|
|
95
97
|
export { default as UserDataNode, userData } from './accessors/UserDataNode.js';
|
|
@@ -107,7 +109,9 @@ export { default as ViewportNode, viewport, viewportCoordinate, viewportResoluti
|
|
|
107
109
|
export { default as ViewportTextureNode, viewportTexture, viewportMipTexture } from './display/ViewportTextureNode.js';
|
|
108
110
|
export { default as ViewportSharedTextureNode, viewportSharedTexture } from './display/ViewportSharedTextureNode.js';
|
|
109
111
|
export { default as ViewportDepthTextureNode, viewportDepthTexture } from './display/ViewportDepthTextureNode.js';
|
|
110
|
-
export { default as ViewportDepthNode, viewZToOrthographicDepth, orthographicDepthToViewZ, viewZToPerspectiveDepth, perspectiveDepthToViewZ, depth, depthTexture } from './display/ViewportDepthNode.js';
|
|
112
|
+
export { default as ViewportDepthNode, viewZToOrthographicDepth, orthographicDepthToViewZ, viewZToPerspectiveDepth, perspectiveDepthToViewZ, depth, depthTexture, depthPixel } from './display/ViewportDepthNode.js';
|
|
113
|
+
export { default as GaussianBlurNode, gaussianBlur } from './display/GaussianBlurNode.js';
|
|
114
|
+
export { default as PassNode, pass, depthPass } from './display/PassNode.js';
|
|
111
115
|
|
|
112
116
|
// code
|
|
113
117
|
export { default as ExpressionNode, expression } from './code/ExpressionNode.js';
|
|
@@ -135,7 +139,7 @@ export { default as DirectionalLightNode } from './lighting/DirectionalLightNode
|
|
|
135
139
|
export { default as SpotLightNode } from './lighting/SpotLightNode.js';
|
|
136
140
|
export { default as IESSpotLightNode } from './lighting/IESSpotLightNode.js';
|
|
137
141
|
export { default as AmbientLightNode } from './lighting/AmbientLightNode.js';
|
|
138
|
-
export { default as LightsNode, lights,
|
|
142
|
+
export { default as LightsNode, lights, lightNodes, addLightNode } from './lighting/LightsNode.js';
|
|
139
143
|
export { default as LightingNode /* @TODO: lighting (abstract), light */ } from './lighting/LightingNode.js';
|
|
140
144
|
export { default as LightingContextNode, lightingContext } from './lighting/LightingContextNode.js';
|
|
141
145
|
export { default as HemisphereLightNode } from './lighting/HemisphereLightNode.js';
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import Object3DNode from './Object3DNode.js';
|
|
2
2
|
import { addNodeClass } from '../core/Node.js';
|
|
3
3
|
import { label } from '../core/ContextNode.js';
|
|
4
|
+
import { NodeUpdateType } from '../core/constants.js';
|
|
5
|
+
//import { sharedUniformGroup } from '../core/UniformGroupNode.js';
|
|
4
6
|
import { nodeImmutable } from '../shadernode/ShaderNode.js';
|
|
5
7
|
|
|
8
|
+
//const cameraGroup = sharedUniformGroup( 'camera' );
|
|
9
|
+
|
|
6
10
|
class CameraNode extends Object3DNode {
|
|
7
11
|
|
|
8
12
|
constructor( scope = CameraNode.POSITION ) {
|
|
9
13
|
|
|
10
14
|
super( scope );
|
|
11
15
|
|
|
16
|
+
this.updateType = NodeUpdateType.RENDER;
|
|
17
|
+
|
|
18
|
+
//this._uniformNode.groupNode = cameraGroup;
|
|
19
|
+
|
|
12
20
|
}
|
|
13
21
|
|
|
14
22
|
getNodeType( builder ) {
|
|
@@ -19,7 +27,7 @@ class CameraNode extends Object3DNode {
|
|
|
19
27
|
|
|
20
28
|
return 'mat4';
|
|
21
29
|
|
|
22
|
-
} else if ( scope === CameraNode.NEAR || scope === CameraNode.FAR ) {
|
|
30
|
+
} else if ( scope === CameraNode.NEAR || scope === CameraNode.FAR || scope === CameraNode.LOG_DEPTH ) {
|
|
23
31
|
|
|
24
32
|
return 'float';
|
|
25
33
|
|
|
@@ -35,6 +43,8 @@ class CameraNode extends Object3DNode {
|
|
|
35
43
|
const uniformNode = this._uniformNode;
|
|
36
44
|
const scope = this.scope;
|
|
37
45
|
|
|
46
|
+
//cameraGroup.needsUpdate = true;
|
|
47
|
+
|
|
38
48
|
if ( scope === CameraNode.VIEW_MATRIX ) {
|
|
39
49
|
|
|
40
50
|
uniformNode.value = camera.matrixWorldInverse;
|
|
@@ -51,6 +61,10 @@ class CameraNode extends Object3DNode {
|
|
|
51
61
|
|
|
52
62
|
uniformNode.value = camera.far;
|
|
53
63
|
|
|
64
|
+
} else if ( scope === CameraNode.LOG_DEPTH ) {
|
|
65
|
+
|
|
66
|
+
uniformNode.value = 2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 );
|
|
67
|
+
|
|
54
68
|
} else {
|
|
55
69
|
|
|
56
70
|
this.object3d = camera;
|
|
@@ -69,7 +83,7 @@ class CameraNode extends Object3DNode {
|
|
|
69
83
|
|
|
70
84
|
this._uniformNode.nodeType = 'mat4';
|
|
71
85
|
|
|
72
|
-
} else if ( scope === CameraNode.NEAR || scope === CameraNode.FAR ) {
|
|
86
|
+
} else if ( scope === CameraNode.NEAR || scope === CameraNode.FAR || scope === CameraNode.LOG_DEPTH ) {
|
|
73
87
|
|
|
74
88
|
this._uniformNode.nodeType = 'float';
|
|
75
89
|
|
|
@@ -84,12 +98,14 @@ class CameraNode extends Object3DNode {
|
|
|
84
98
|
CameraNode.PROJECTION_MATRIX = 'projectionMatrix';
|
|
85
99
|
CameraNode.NEAR = 'near';
|
|
86
100
|
CameraNode.FAR = 'far';
|
|
101
|
+
CameraNode.LOG_DEPTH = 'logDepth';
|
|
87
102
|
|
|
88
103
|
export default CameraNode;
|
|
89
104
|
|
|
90
105
|
export const cameraProjectionMatrix = label( nodeImmutable( CameraNode, CameraNode.PROJECTION_MATRIX ), 'projectionMatrix' );
|
|
91
106
|
export const cameraNear = nodeImmutable( CameraNode, CameraNode.NEAR );
|
|
92
107
|
export const cameraFar = nodeImmutable( CameraNode, CameraNode.FAR );
|
|
108
|
+
export const cameraLogDepth = nodeImmutable( CameraNode, CameraNode.LOG_DEPTH );
|
|
93
109
|
export const cameraViewMatrix = nodeImmutable( CameraNode, CameraNode.VIEW_MATRIX );
|
|
94
110
|
export const cameraNormalMatrix = nodeImmutable( CameraNode, CameraNode.NORMAL_MATRIX );
|
|
95
111
|
export const cameraWorldMatrix = nodeImmutable( CameraNode, CameraNode.WORLD_MATRIX );
|