super-three 0.167.0 → 0.168.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +165 -44
- package/build/three.module.js +165 -45
- package/build/three.module.min.js +1 -1
- package/build/three.webgpu.js +23600 -21931
- package/build/three.webgpu.min.js +1 -1
- package/examples/jsm/Addons.js +3 -1
- package/examples/jsm/animation/AnimationClipCreator.js +1 -1
- package/examples/jsm/capabilities/WebGL.js +27 -21
- package/examples/jsm/controls/ArcballControls.js +174 -158
- package/examples/jsm/controls/DragControls.js +260 -132
- package/examples/jsm/controls/FirstPersonControls.js +175 -163
- package/examples/jsm/controls/FlyControls.js +194 -188
- package/examples/jsm/controls/OrbitControls.js +777 -786
- package/examples/jsm/controls/PointerLockControls.js +24 -15
- package/examples/jsm/controls/TrackballControls.js +453 -452
- package/examples/jsm/effects/AnaglyphEffect.js +6 -13
- package/examples/jsm/effects/ParallaxBarrierEffect.js +17 -11
- package/examples/jsm/effects/StereoEffect.js +6 -1
- package/examples/jsm/environments/RoomEnvironment.js +1 -1
- package/examples/jsm/exporters/GLTFExporter.js +6 -1
- package/examples/jsm/exporters/USDZExporter.js +29 -8
- package/examples/jsm/helpers/LightProbeHelper.js +42 -43
- package/examples/jsm/loaders/KTX2Loader.js +19 -7
- package/examples/jsm/loaders/MaterialXLoader.js +11 -4
- package/examples/jsm/loaders/PCDLoader.js +9 -9
- package/examples/jsm/objects/SkyMesh.js +188 -0
- package/examples/jsm/objects/Water2Mesh.js +159 -0
- package/examples/jsm/objects/WaterMesh.js +102 -0
- package/examples/jsm/physics/RapierPhysics.js +20 -0
- package/examples/jsm/postprocessing/OutlinePass.js +31 -46
- package/examples/jsm/postprocessing/SSAARenderPass.js +3 -1
- package/examples/jsm/shaders/BleachBypassShader.js +1 -2
- package/examples/jsm/shaders/OutputShader.js +1 -1
- package/examples/jsm/transpiler/TSLEncoder.js +8 -8
- package/examples/jsm/utils/TextureUtils.js +1 -1
- package/package.json +2 -1
- package/src/Three.WebGPU.js +6 -0
- package/src/Three.js +1 -0
- package/src/constants.js +1 -1
- package/src/extras/Controls.js +32 -0
- package/src/loaders/ObjectLoader.js +3 -3
- package/src/{nodes/loaders → loaders/nodes}/NodeLoader.js +4 -4
- package/src/{nodes/loaders → loaders/nodes}/NodeMaterialLoader.js +1 -2
- package/src/materials/Material.js +4 -7
- package/src/{nodes/materials → materials/nodes}/InstancedPointsNodeMaterial.js +33 -24
- package/src/{nodes/materials → materials/nodes}/Line2NodeMaterial.js +34 -37
- package/src/{nodes/materials → materials/nodes}/LineBasicNodeMaterial.js +3 -4
- package/src/{nodes/materials → materials/nodes}/LineDashedNodeMaterial.js +7 -9
- package/src/{nodes/materials → materials/nodes}/MeshBasicNodeMaterial.js +11 -11
- package/src/{nodes/materials → materials/nodes}/MeshLambertNodeMaterial.js +5 -5
- package/src/{nodes/materials → materials/nodes}/MeshMatcapNodeMaterial.js +8 -8
- package/src/materials/nodes/MeshNormalNodeMaterial.js +40 -0
- package/src/{nodes/materials → materials/nodes}/MeshPhongNodeMaterial.js +9 -8
- package/src/{nodes/materials → materials/nodes}/MeshPhysicalNodeMaterial.js +18 -17
- package/src/{nodes/materials → materials/nodes}/MeshSSSNodeMaterial.js +6 -6
- package/src/{nodes/materials → materials/nodes}/MeshStandardNodeMaterial.js +17 -11
- package/src/{nodes/materials → materials/nodes}/MeshToonNodeMaterial.js +4 -4
- package/src/{nodes/materials → materials/nodes}/NodeMaterial.js +67 -86
- package/src/{nodes/materials/Materials.js → materials/nodes/NodeMaterials.js} +1 -1
- package/src/{nodes/materials → materials/nodes}/PointsNodeMaterial.js +3 -4
- package/src/{nodes/materials → materials/nodes}/ShadowNodeMaterial.js +4 -4
- package/src/{nodes/materials → materials/nodes}/SpriteNodeMaterial.js +11 -11
- package/src/{nodes/materials → materials/nodes}/VolumeNodeMaterial.js +14 -16
- package/src/nodes/Nodes.js +103 -159
- package/src/nodes/TSL.js +176 -0
- package/src/nodes/accessors/AccessorsUtils.js +8 -8
- package/src/nodes/accessors/BatchNode.js +48 -20
- package/src/nodes/accessors/{BitangentNode.js → Bitangent.js} +9 -9
- package/src/nodes/accessors/BufferAttributeNode.js +5 -5
- package/src/nodes/accessors/BufferNode.js +4 -4
- package/src/nodes/accessors/{CameraNode.js → Camera.js} +10 -10
- package/src/nodes/accessors/ClippingNode.js +16 -14
- package/src/nodes/accessors/CubeTextureNode.js +5 -7
- package/src/nodes/accessors/InstanceNode.js +17 -13
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +4 -4
- package/src/nodes/accessors/MaterialNode.js +52 -55
- package/src/nodes/accessors/MaterialProperties.js +3 -0
- package/src/nodes/accessors/MaterialReferenceNode.js +6 -4
- package/src/nodes/accessors/ModelNode.js +11 -11
- package/src/nodes/accessors/ModelViewProjectionNode.js +6 -7
- package/src/nodes/accessors/MorphNode.js +12 -12
- package/src/nodes/accessors/Normal.js +62 -0
- package/src/nodes/accessors/Object3DNode.js +10 -10
- package/src/nodes/accessors/PointUVNode.js +4 -4
- package/src/nodes/accessors/Position.js +10 -0
- package/src/nodes/accessors/ReferenceBaseNode.js +143 -0
- package/src/nodes/accessors/ReferenceNode.js +13 -7
- package/src/nodes/accessors/ReflectVector.js +10 -0
- package/src/nodes/accessors/RendererReferenceNode.js +6 -6
- package/src/nodes/accessors/SceneNode.js +5 -6
- package/src/nodes/accessors/SkinningNode.js +84 -21
- package/src/nodes/accessors/StorageBufferNode.js +4 -5
- package/src/nodes/accessors/StorageTextureNode.js +5 -5
- package/src/nodes/accessors/Tangent.js +22 -0
- package/src/nodes/accessors/Texture3DNode.js +11 -11
- package/src/nodes/accessors/{TextureBicubicNode.js → TextureBicubic.js} +3 -32
- package/src/nodes/accessors/TextureNode.js +16 -21
- package/src/nodes/accessors/TextureSizeNode.js +4 -6
- package/src/nodes/accessors/{UniformsNode.js → UniformArrayNode.js} +17 -8
- package/src/nodes/accessors/UserDataNode.js +4 -4
- package/src/nodes/accessors/VelocityNode.js +83 -0
- package/src/nodes/accessors/VertexColorNode.js +4 -4
- package/src/nodes/code/CodeNode.js +5 -5
- package/src/nodes/code/ExpressionNode.js +4 -4
- package/src/nodes/code/FunctionCallNode.js +5 -5
- package/src/nodes/code/FunctionNode.js +5 -23
- package/src/nodes/code/ScriptableNode.js +4 -6
- package/src/nodes/code/ScriptableValueNode.js +4 -6
- package/src/nodes/core/AssignNode.js +5 -5
- package/src/nodes/core/AttributeNode.js +7 -20
- package/src/nodes/core/BypassNode.js +5 -5
- package/src/nodes/core/CacheNode.js +5 -5
- package/src/nodes/core/ConstNode.js +2 -2
- package/src/nodes/core/ContextNode.js +17 -11
- package/src/nodes/core/IndexNode.js +12 -7
- package/src/nodes/core/InputNode.js +2 -2
- package/src/nodes/core/MRTNode.js +12 -6
- package/src/nodes/core/Node.js +39 -19
- package/src/nodes/core/NodeBuilder.js +46 -33
- package/src/nodes/core/NodeUtils.js +1 -0
- package/src/nodes/core/OutputStructNode.js +4 -4
- package/src/nodes/core/ParameterNode.js +4 -4
- package/src/nodes/core/PropertyNode.js +32 -32
- package/src/nodes/core/StackNode.js +26 -10
- package/src/nodes/core/StructTypeNode.js +2 -2
- package/src/nodes/core/TempNode.js +2 -2
- package/src/nodes/core/UniformGroupNode.js +8 -9
- package/src/nodes/core/UniformNode.js +4 -4
- package/src/nodes/core/VarNode.js +6 -6
- package/src/nodes/core/VaryingNode.js +5 -5
- package/src/nodes/display/AfterImageNode.js +9 -9
- package/src/nodes/display/AnaglyphPassNode.js +61 -0
- package/src/nodes/display/AnamorphicNode.js +11 -11
- package/src/nodes/display/BleachBypass.js +26 -0
- package/src/nodes/display/BlendMode.js +54 -0
- package/src/nodes/display/BloomNode.js +21 -19
- package/src/nodes/display/BumpMapNode.js +7 -12
- package/src/nodes/display/ColorAdjustment.js +46 -0
- package/src/nodes/display/ColorSpaceFunctions.js +38 -0
- package/src/nodes/display/ColorSpaceNode.js +40 -63
- package/src/nodes/display/DenoiseNode.js +20 -17
- package/src/nodes/display/DepthOfFieldNode.js +8 -6
- package/src/nodes/display/DotScreenNode.js +10 -22
- package/src/nodes/display/FXAANode.js +17 -15
- package/src/nodes/display/FilmNode.js +7 -6
- package/src/nodes/display/FrontFacingNode.js +5 -5
- package/src/nodes/display/GTAONode.js +19 -15
- package/src/nodes/display/GaussianBlurNode.js +11 -8
- package/src/nodes/display/Lut3DNode.js +6 -5
- package/src/nodes/display/MotionBlur.js +25 -0
- package/src/nodes/display/NormalMapNode.js +8 -10
- package/src/nodes/display/ParallaxBarrierPassNode.js +55 -0
- package/src/nodes/display/PassNode.js +84 -8
- package/src/nodes/display/PixelationPassNode.js +12 -7
- package/src/nodes/display/PosterizeNode.js +4 -6
- package/src/nodes/display/RGBShiftNode.js +8 -7
- package/src/nodes/display/RenderOutputNode.js +9 -9
- package/src/nodes/display/SSAAPassNode.js +284 -0
- package/src/nodes/display/Sepia.js +17 -0
- package/src/nodes/display/SobelOperatorNode.js +9 -7
- package/src/nodes/display/StereoCompositePassNode.js +107 -0
- package/src/nodes/display/StereoPassNode.js +80 -0
- package/src/nodes/display/ToneMappingFunctions.js +190 -0
- package/src/nodes/display/ToneMappingNode.js +12 -173
- package/src/nodes/display/TransitionNode.js +9 -8
- package/src/nodes/display/ViewportDepthNode.js +30 -29
- package/src/nodes/display/ViewportDepthTextureNode.js +6 -8
- package/src/nodes/display/ViewportNode.js +26 -25
- package/src/nodes/display/ViewportSharedTextureNode.js +6 -8
- package/src/nodes/display/ViewportTextureNode.js +7 -10
- package/src/nodes/fog/FogExp2Node.js +4 -6
- package/src/nodes/fog/FogNode.js +5 -7
- package/src/nodes/fog/FogRangeNode.js +4 -6
- package/src/nodes/functions/BSDF/BRDF_GGX.js +4 -4
- package/src/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +6 -6
- package/src/nodes/functions/BSDF/DFGApprox.js +2 -2
- package/src/nodes/functions/BSDF/D_GGX.js +2 -2
- package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +3 -3
- package/src/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
- package/src/nodes/functions/BSDF/F_Schlick.js +2 -2
- package/src/nodes/functions/BSDF/LTC.js +6 -6
- package/src/nodes/functions/BSDF/Schlick_to_F0.js +2 -2
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +2 -2
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +2 -2
- package/src/nodes/functions/BasicLightingModel.js +1 -1
- package/src/nodes/functions/PhongLightingModel.js +5 -5
- package/src/nodes/functions/PhysicalLightingModel.js +32 -31
- package/src/nodes/functions/ShadowMaskModel.js +1 -1
- package/src/nodes/functions/ToonLightingModel.js +3 -3
- package/src/nodes/functions/material/getGeometryRoughness.js +4 -4
- package/src/nodes/functions/material/getRoughness.js +2 -2
- package/src/nodes/geometry/RangeNode.js +4 -4
- package/src/nodes/gpgpu/ComputeNode.js +5 -5
- package/src/nodes/lighting/AONode.js +2 -2
- package/src/nodes/lighting/AmbientLightNode.js +2 -7
- package/src/nodes/lighting/AnalyticLightNode.js +34 -13
- package/src/nodes/lighting/BasicEnvironmentNode.js +4 -3
- package/src/nodes/lighting/BasicLightMapNode.js +3 -3
- package/src/nodes/lighting/DirectionalLightNode.js +2 -7
- package/src/nodes/lighting/EnvironmentNode.js +20 -19
- package/src/nodes/lighting/HemisphereLightNode.js +3 -7
- package/src/nodes/lighting/IESSpotLightNode.js +3 -8
- package/src/nodes/lighting/IrradianceNode.js +2 -2
- package/src/nodes/lighting/LightNode.js +5 -5
- package/src/nodes/lighting/LightProbeNode.js +76 -0
- package/src/nodes/lighting/LightUtils.js +3 -3
- package/src/nodes/lighting/LightingContextNode.js +15 -17
- package/src/nodes/lighting/LightingNode.js +2 -2
- package/src/nodes/lighting/LightsNode.js +94 -76
- package/src/nodes/lighting/PointLightNode.js +3 -8
- package/src/nodes/lighting/RectAreaLightNode.js +2 -6
- package/src/nodes/lighting/SpotLightNode.js +3 -8
- package/src/nodes/materialx/MaterialXNodes.js +2 -2
- package/src/nodes/materialx/lib/mx_hsv.js +36 -31
- package/src/nodes/materialx/lib/mx_noise.js +96 -96
- package/src/nodes/materialx/lib/mx_transform_color.js +2 -2
- package/src/nodes/math/{CondNode.js → ConditionalNode.js} +18 -7
- package/src/nodes/math/Hash.js +13 -0
- package/src/nodes/math/MathNode.js +124 -124
- package/src/nodes/math/MathUtils.js +0 -7
- package/src/nodes/math/OperatorNode.js +94 -52
- package/src/nodes/math/TriNoise3D.js +19 -29
- package/src/nodes/pmrem/PMREMNode.js +58 -15
- package/src/nodes/pmrem/PMREMUtils.js +46 -46
- package/src/nodes/procedural/Checker.js +14 -0
- package/src/nodes/tsl/TSLBase.js +30 -0
- package/src/nodes/{shadernode/ShaderNode.js → tsl/TSLCore.js} +105 -97
- package/src/nodes/utils/ArrayElementNode.js +2 -2
- package/src/nodes/utils/ConvertNode.js +2 -2
- package/src/nodes/utils/CubeMapNode.js +157 -0
- package/src/nodes/utils/Discard.js +8 -0
- package/src/nodes/utils/EquirectUVNode.js +5 -5
- package/src/nodes/utils/FlipNode.js +65 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +5 -5
- package/src/nodes/utils/JoinNode.js +2 -2
- package/src/nodes/utils/LoopNode.js +12 -6
- package/src/nodes/utils/MatcapUVNode.js +6 -6
- package/src/nodes/utils/MaxMipLevelNode.js +4 -4
- package/src/nodes/utils/OscNode.js +7 -7
- package/src/nodes/utils/Packing.js +4 -0
- package/src/nodes/utils/RTTNode.js +8 -8
- package/src/nodes/utils/ReflectorNode.js +8 -3
- package/src/nodes/utils/RemapNode.js +7 -7
- package/src/nodes/utils/RotateNode.js +4 -12
- package/src/nodes/utils/SetNode.js +2 -2
- package/src/nodes/utils/SplitNode.js +2 -2
- package/src/nodes/utils/SpriteSheetUVNode.js +5 -5
- package/src/nodes/utils/SpriteUtils.js +47 -0
- package/src/nodes/utils/StorageArrayElementNode.js +4 -6
- package/src/nodes/utils/TimerNode.js +5 -5
- package/src/nodes/utils/TriplanarTexturesNode.js +7 -9
- package/src/nodes/utils/UVUtils.js +19 -0
- package/src/nodes/utils/ViewportUtils.js +14 -0
- package/src/objects/BatchedMesh.js +2 -3
- package/src/renderers/WebGLRenderer.js +24 -0
- package/src/renderers/common/Backend.js +2 -2
- package/src/renderers/common/Background.js +3 -1
- package/src/renderers/common/BindGroup.js +3 -1
- package/src/renderers/common/Bindings.js +13 -15
- package/src/renderers/common/ClippingContext.js +14 -5
- package/src/renderers/common/CubeRenderTarget.js +9 -3
- package/src/renderers/common/PostProcessing.js +4 -1
- package/src/renderers/common/QuadMesh.js +2 -0
- package/src/renderers/common/RenderContext.js +24 -0
- package/src/renderers/common/RenderList.js +1 -1
- package/src/renderers/common/RenderObject.js +2 -2
- package/src/renderers/common/Renderer.js +75 -49
- package/src/renderers/common/SampledTexture.js +12 -3
- package/src/renderers/common/StandardRenderer.js +18 -0
- package/src/renderers/common/Textures.js +8 -12
- package/src/renderers/common/extras/PMREMGenerator.js +12 -13
- package/src/renderers/common/nodes/NodeBuilderState.js +1 -1
- package/src/renderers/common/nodes/NodeLibrary.js +118 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +2 -2
- package/src/renderers/common/nodes/Nodes.js +36 -9
- package/src/renderers/common/nodes/StandardNodeLibrary.js +105 -0
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +2 -2
- package/src/renderers/webgl/WebGLProgram.js +1 -1
- package/src/renderers/webgl/WebGLProperties.js +7 -0
- package/src/renderers/webgl/WebGLTextures.js +61 -4
- package/src/renderers/webgl-fallback/WebGLBackend.js +88 -68
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +57 -9
- package/src/renderers/webgl-fallback/utils/WebGLState.js +21 -0
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +28 -21
- package/src/renderers/webgpu/WebGPUBackend.js +86 -68
- package/src/renderers/webgpu/WebGPURenderer.js +8 -8
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +99 -63
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +45 -21
- package/src/renderers/webgpu/utils/WebGPUConstants.js +2 -1
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +6 -15
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +62 -5
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +36 -21
- package/src/renderers/webgpu/utils/WebGPUUtils.js +18 -1
- package/src/renderers/webxr/WebXRManager.js +32 -25
- package/examples/jsm/loaders/LogLuvLoader.js +0 -606
- package/src/nodes/accessors/NormalNode.js +0 -14
- package/src/nodes/accessors/PositionNode.js +0 -10
- package/src/nodes/accessors/ReflectVectorNode.js +0 -10
- package/src/nodes/accessors/TangentNode.js +0 -23
- package/src/nodes/core/NodeKeywords.js +0 -80
- package/src/nodes/display/BlendModeNode.js +0 -128
- package/src/nodes/display/ColorAdjustmentNode.js +0 -104
- package/src/nodes/materials/MeshNormalNodeMaterial.js +0 -40
- package/src/nodes/math/HashNode.js +0 -34
- package/src/nodes/procedural/CheckerNode.js +0 -42
- package/src/nodes/utils/DiscardNode.js +0 -28
- package/src/nodes/utils/PackingNode.js +0 -55
- package/src/nodes/utils/RotateUVNode.js +0 -35
- /package/src/{nodes/loaders → loaders/nodes}/NodeObjectLoader.js +0 -0
- /package/src/nodes/accessors/{UVNode.js → UV.js} +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import Node, {
|
|
2
|
-
import { normalLocal } from './
|
|
3
|
-
import { positionLocal } from './
|
|
4
|
-
import { nodeProxy, vec3, mat3, mat4, int, ivec2, float,
|
|
1
|
+
import Node, { registerNode } from '../core/Node.js';
|
|
2
|
+
import { normalLocal } from './Normal.js';
|
|
3
|
+
import { positionLocal } from './Position.js';
|
|
4
|
+
import { nodeProxy, vec3, mat3, mat4, int, ivec2, float, Fn } from '../tsl/TSLBase.js';
|
|
5
5
|
import { textureLoad } from './TextureNode.js';
|
|
6
6
|
import { textureSize } from './TextureSizeNode.js';
|
|
7
|
-
import { tangentLocal } from './
|
|
7
|
+
import { tangentLocal } from './Tangent.js';
|
|
8
8
|
import { instanceIndex, drawIndex } from '../core/IndexNode.js';
|
|
9
|
+
import { varyingProperty } from '../core/PropertyNode.js';
|
|
9
10
|
|
|
10
11
|
class BatchNode extends Node {
|
|
11
12
|
|
|
@@ -16,8 +17,6 @@ class BatchNode extends Node {
|
|
|
16
17
|
this.batchMesh = batchMesh;
|
|
17
18
|
|
|
18
19
|
|
|
19
|
-
this.instanceColorNode = null;
|
|
20
|
-
|
|
21
20
|
this.batchingIdNode = null;
|
|
22
21
|
|
|
23
22
|
}
|
|
@@ -40,10 +39,10 @@ class BatchNode extends Node {
|
|
|
40
39
|
|
|
41
40
|
}
|
|
42
41
|
|
|
43
|
-
const getIndirectIndex =
|
|
42
|
+
const getIndirectIndex = Fn( ( [ id ] ) => {
|
|
44
43
|
|
|
45
44
|
const size = textureSize( textureLoad( this.batchMesh._indirectTexture ), 0 );
|
|
46
|
-
const x = int( id ).
|
|
45
|
+
const x = int( id ).modInt( int( size ) );
|
|
47
46
|
const y = int( id ).div( int( size ) );
|
|
48
47
|
return textureLoad( this.batchMesh._indirectTexture, ivec2( x, y ) ).x;
|
|
49
48
|
|
|
@@ -55,20 +54,49 @@ class BatchNode extends Node {
|
|
|
55
54
|
]
|
|
56
55
|
} );
|
|
57
56
|
|
|
58
|
-
const
|
|
57
|
+
const indirectId = getIndirectIndex( int( this.batchingIdNode ) );
|
|
58
|
+
|
|
59
|
+
const matricesTexture = this.batchMesh._matricesTexture;
|
|
59
60
|
|
|
60
|
-
const size = textureSize( textureLoad(
|
|
61
|
-
const j = float(
|
|
61
|
+
const size = textureSize( textureLoad( matricesTexture ), 0 );
|
|
62
|
+
const j = float( indirectId ).mul( 4 ).toInt().toVar();
|
|
62
63
|
|
|
63
|
-
const x =
|
|
64
|
-
const y =
|
|
64
|
+
const x = j.modInt( size );
|
|
65
|
+
const y = j.div( int( size ) );
|
|
65
66
|
const batchingMatrix = mat4(
|
|
66
|
-
textureLoad(
|
|
67
|
-
textureLoad(
|
|
68
|
-
textureLoad(
|
|
69
|
-
textureLoad(
|
|
67
|
+
textureLoad( matricesTexture, ivec2( x, y ) ),
|
|
68
|
+
textureLoad( matricesTexture, ivec2( x.add( 1 ), y ) ),
|
|
69
|
+
textureLoad( matricesTexture, ivec2( x.add( 2 ), y ) ),
|
|
70
|
+
textureLoad( matricesTexture, ivec2( x.add( 3 ), y ) )
|
|
70
71
|
);
|
|
71
72
|
|
|
73
|
+
|
|
74
|
+
const colorsTexture = this.batchMesh._colorsTexture;
|
|
75
|
+
|
|
76
|
+
if ( colorsTexture !== null ) {
|
|
77
|
+
|
|
78
|
+
const getBatchingColor = Fn( ( [ id ] ) => {
|
|
79
|
+
|
|
80
|
+
const size = textureSize( textureLoad( colorsTexture ), 0 ).x;
|
|
81
|
+
const j = id;
|
|
82
|
+
const x = j.modInt( size );
|
|
83
|
+
const y = j.div( size );
|
|
84
|
+
return textureLoad( colorsTexture, ivec2( x, y ) ).rgb;
|
|
85
|
+
|
|
86
|
+
} ).setLayout( {
|
|
87
|
+
name: 'getBatchingColor',
|
|
88
|
+
type: 'vec3',
|
|
89
|
+
inputs: [
|
|
90
|
+
{ name: 'id', type: 'int' }
|
|
91
|
+
]
|
|
92
|
+
} );
|
|
93
|
+
|
|
94
|
+
const color = getBatchingColor( indirectId );
|
|
95
|
+
|
|
96
|
+
varyingProperty( 'vec3', 'vBatchColor' ).assign( color );
|
|
97
|
+
|
|
98
|
+
}
|
|
99
|
+
|
|
72
100
|
const bm = mat3( batchingMatrix );
|
|
73
101
|
|
|
74
102
|
positionLocal.assign( batchingMatrix.mul( positionLocal ) );
|
|
@@ -91,6 +119,6 @@ class BatchNode extends Node {
|
|
|
91
119
|
|
|
92
120
|
export default BatchNode;
|
|
93
121
|
|
|
94
|
-
|
|
122
|
+
BatchNode.type = /*@__PURE__*/ registerNode( 'Batch', BatchNode );
|
|
95
123
|
|
|
96
|
-
|
|
124
|
+
export const batch = /*@__PURE__*/ nodeProxy( BatchNode );
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { varying } from '../core/VaryingNode.js';
|
|
2
|
-
import { cameraViewMatrix } from './
|
|
3
|
-
import { normalGeometry, normalLocal, normalView, normalWorld, transformedNormalView } from './
|
|
4
|
-
import { tangentGeometry, tangentLocal, tangentView, tangentWorld, transformedTangentView } from './
|
|
2
|
+
import { cameraViewMatrix } from './Camera.js';
|
|
3
|
+
import { normalGeometry, normalLocal, normalView, normalWorld, transformedNormalView } from './Normal.js';
|
|
4
|
+
import { tangentGeometry, tangentLocal, tangentView, tangentWorld, transformedTangentView } from './Tangent.js';
|
|
5
5
|
|
|
6
6
|
const getBitangent = ( crossNormalTangent ) => crossNormalTangent.mul( tangentGeometry.w ).xyz;
|
|
7
7
|
|
|
8
|
-
export const bitangentGeometry =
|
|
9
|
-
export const bitangentLocal =
|
|
10
|
-
export const bitangentView =
|
|
11
|
-
export const bitangentWorld =
|
|
12
|
-
export const transformedBitangentView =
|
|
13
|
-
export const transformedBitangentWorld =
|
|
8
|
+
export const bitangentGeometry = /*@__PURE__*/ varying( getBitangent( normalGeometry.cross( tangentGeometry ) ), 'v_bitangentGeometry' ).normalize().toVar( 'bitangentGeometry' );
|
|
9
|
+
export const bitangentLocal = /*@__PURE__*/ varying( getBitangent( normalLocal.cross( tangentLocal ) ), 'v_bitangentLocal' ).normalize().toVar( 'bitangentLocal' );
|
|
10
|
+
export const bitangentView = /*@__PURE__*/ varying( getBitangent( normalView.cross( tangentView ) ), 'v_bitangentView' ).normalize().toVar( 'bitangentView' );
|
|
11
|
+
export const bitangentWorld = /*@__PURE__*/ varying( getBitangent( normalWorld.cross( tangentWorld ) ), 'v_bitangentWorld' ).normalize().toVar( 'bitangentWorld' );
|
|
12
|
+
export const transformedBitangentView = /*@__PURE__*/ getBitangent( transformedNormalView.cross( transformedTangentView ) ).normalize().toVar( 'transformedBitangentView' );
|
|
13
|
+
export const transformedBitangentWorld = /*@__PURE__*/ transformedBitangentView.transformDirection( cameraViewMatrix ).normalize().toVar( 'transformedBitangentWorld' );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import InputNode from '../core/InputNode.js';
|
|
2
|
-
import {
|
|
3
|
+
import { nodeObject, addMethodChaining } from '../tsl/TSLCore.js';
|
|
3
4
|
import { varying } from '../core/VaryingNode.js';
|
|
4
|
-
import { nodeObject, addNodeElement } from '../shadernode/ShaderNode.js';
|
|
5
5
|
|
|
6
6
|
import { InterleavedBufferAttribute } from '../../core/InterleavedBufferAttribute.js';
|
|
7
7
|
import { InterleavedBuffer } from '../../core/InterleavedBuffer.js';
|
|
@@ -151,12 +151,12 @@ class BufferAttributeNode extends InputNode {
|
|
|
151
151
|
|
|
152
152
|
export default BufferAttributeNode;
|
|
153
153
|
|
|
154
|
+
BufferAttributeNode.type = /*@__PURE__*/ registerNode( 'BufferAttribute', BufferAttributeNode );
|
|
155
|
+
|
|
154
156
|
export const bufferAttribute = ( array, type, stride, offset ) => nodeObject( new BufferAttributeNode( array, type, stride, offset ) );
|
|
155
157
|
export const dynamicBufferAttribute = ( array, type, stride, offset ) => bufferAttribute( array, type, stride, offset ).setUsage( DynamicDrawUsage );
|
|
156
158
|
|
|
157
159
|
export const instancedBufferAttribute = ( array, type, stride, offset ) => bufferAttribute( array, type, stride, offset ).setInstanced( true );
|
|
158
160
|
export const instancedDynamicBufferAttribute = ( array, type, stride, offset ) => dynamicBufferAttribute( array, type, stride, offset ).setInstanced( true );
|
|
159
161
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
addNodeClass( 'BufferAttributeNode', BufferAttributeNode );
|
|
162
|
+
addMethodChaining( 'toAttribute', ( bufferNode ) => bufferAttribute( bufferNode.value ) );
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import UniformNode from '../core/UniformNode.js';
|
|
2
|
-
import {
|
|
3
|
-
import { nodeObject } from '../shadernode/ShaderNode.js';
|
|
3
|
+
import { nodeObject } from '../tsl/TSLBase.js';
|
|
4
4
|
|
|
5
5
|
class BufferNode extends UniformNode {
|
|
6
6
|
|
|
@@ -31,6 +31,6 @@ class BufferNode extends UniformNode {
|
|
|
31
31
|
|
|
32
32
|
export default BufferNode;
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
BufferNode.type = /*@__PURE__*/ registerNode( 'Buffer', BufferNode );
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
export const buffer = ( value, type, count ) => nodeObject( new BufferNode( value, type, count ) );
|
|
@@ -2,18 +2,18 @@ import { uniform } from '../core/UniformNode.js';
|
|
|
2
2
|
import { sharedUniformGroup } from '../core/UniformGroupNode.js';
|
|
3
3
|
import { Vector3 } from '../../math/Vector3.js';
|
|
4
4
|
|
|
5
|
-
const cameraGroup =
|
|
5
|
+
const cameraGroup = /*@__PURE__*/ sharedUniformGroup( 'camera' ).onRenderUpdate( () => {
|
|
6
6
|
|
|
7
7
|
cameraGroup.needsUpdate = true;
|
|
8
8
|
|
|
9
9
|
} );
|
|
10
10
|
|
|
11
|
-
export const cameraNear =
|
|
12
|
-
export const cameraFar =
|
|
13
|
-
export const cameraLogDepth =
|
|
14
|
-
export const cameraProjectionMatrix =
|
|
15
|
-
export const cameraProjectionMatrixInverse =
|
|
16
|
-
export const cameraViewMatrix =
|
|
17
|
-
export const cameraWorldMatrix =
|
|
18
|
-
export const cameraNormalMatrix =
|
|
19
|
-
export const cameraPosition =
|
|
11
|
+
export const cameraNear = /*@__PURE__*/ uniform( 'float' ).label( 'cameraNear' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera } ) => camera.near );
|
|
12
|
+
export const cameraFar = /*@__PURE__*/ uniform( 'float' ).label( 'cameraFar' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera } ) => camera.far );
|
|
13
|
+
export const cameraLogDepth = /*@__PURE__*/ uniform( 'float' ).label( 'cameraLogDepth' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera } ) => 2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );
|
|
14
|
+
export const cameraProjectionMatrix = /*@__PURE__*/ uniform( 'mat4' ).label( 'cameraProjectionMatrix' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera } ) => camera.projectionMatrix );
|
|
15
|
+
export const cameraProjectionMatrixInverse = /*@__PURE__*/ uniform( 'mat4' ).label( 'cameraProjectionMatrixInverse' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera } ) => camera.projectionMatrixInverse );
|
|
16
|
+
export const cameraViewMatrix = /*@__PURE__*/ uniform( 'mat4' ).label( 'cameraViewMatrix' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera } ) => camera.matrixWorldInverse );
|
|
17
|
+
export const cameraWorldMatrix = /*@__PURE__*/ uniform( 'mat4' ).label( 'cameraWorldMatrix' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera } ) => camera.matrixWorld );
|
|
18
|
+
export const cameraNormalMatrix = /*@__PURE__*/ uniform( 'mat3' ).label( 'cameraNormalMatrix' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera } ) => camera.normalMatrix );
|
|
19
|
+
export const cameraPosition = /*@__PURE__*/ uniform( new Vector3() ).label( 'cameraPosition' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera }, self ) => self.value.setFromMatrixPosition( camera.matrixWorld ) );
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
|
-
import Node from '../core/Node.js';
|
|
3
|
-
import { nodeObject } from '../
|
|
4
|
-
import { positionView } from './
|
|
2
|
+
import Node, { registerNode } from '../core/Node.js';
|
|
3
|
+
import { nodeObject } from '../tsl/TSLBase.js';
|
|
4
|
+
import { positionView } from './Position.js';
|
|
5
5
|
import { diffuseColor, property } from '../core/PropertyNode.js';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { Fn } from '../tsl/TSLBase.js';
|
|
7
|
+
import { Loop } from '../utils/LoopNode.js';
|
|
8
8
|
import { smoothstep } from '../math/MathNode.js';
|
|
9
|
-
import {
|
|
9
|
+
import { uniformArray } from './UniformArrayNode.js';
|
|
10
10
|
|
|
11
11
|
class ClippingNode extends Node {
|
|
12
12
|
|
|
@@ -42,9 +42,9 @@ class ClippingNode extends Node {
|
|
|
42
42
|
|
|
43
43
|
setupAlphaToCoverage( planes, numClippingPlanes, numUnionClippingPlanes ) {
|
|
44
44
|
|
|
45
|
-
return
|
|
45
|
+
return Fn( () => {
|
|
46
46
|
|
|
47
|
-
const clippingPlanes =
|
|
47
|
+
const clippingPlanes = uniformArray( planes );
|
|
48
48
|
|
|
49
49
|
const distanceToPlane = property( 'float', 'distanceToPlane' );
|
|
50
50
|
const distanceGradient = property( 'float', 'distanceToGradient' );
|
|
@@ -55,7 +55,7 @@ class ClippingNode extends Node {
|
|
|
55
55
|
|
|
56
56
|
let plane;
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
Loop( numUnionClippingPlanes, ( { i } ) => {
|
|
59
59
|
|
|
60
60
|
plane = clippingPlanes.element( i );
|
|
61
61
|
|
|
@@ -74,7 +74,7 @@ class ClippingNode extends Node {
|
|
|
74
74
|
|
|
75
75
|
unionClipOpacity.assign( 1 );
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
Loop( { start: numUnionClippingPlanes, end: numClippingPlanes }, ( { i } ) => {
|
|
78
78
|
|
|
79
79
|
plane = clippingPlanes.element( i );
|
|
80
80
|
|
|
@@ -99,13 +99,13 @@ class ClippingNode extends Node {
|
|
|
99
99
|
|
|
100
100
|
setupDefault( planes, numClippingPlanes, numUnionClippingPlanes ) {
|
|
101
101
|
|
|
102
|
-
return
|
|
102
|
+
return Fn( () => {
|
|
103
103
|
|
|
104
|
-
const clippingPlanes =
|
|
104
|
+
const clippingPlanes = uniformArray( planes );
|
|
105
105
|
|
|
106
106
|
let plane;
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
Loop( numUnionClippingPlanes, ( { i } ) => {
|
|
109
109
|
|
|
110
110
|
plane = clippingPlanes.element( i );
|
|
111
111
|
positionView.dot( plane.xyz ).greaterThan( plane.w ).discard();
|
|
@@ -118,7 +118,7 @@ class ClippingNode extends Node {
|
|
|
118
118
|
|
|
119
119
|
clipped.assign( true );
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
Loop( { start: numUnionClippingPlanes, end: numClippingPlanes }, ( { i } ) => {
|
|
122
122
|
|
|
123
123
|
plane = clippingPlanes.element( i );
|
|
124
124
|
clipped.assign( positionView.dot( plane.xyz ).greaterThan( plane.w ).and( clipped ) );
|
|
@@ -140,6 +140,8 @@ ClippingNode.DEFAULT = 'default';
|
|
|
140
140
|
|
|
141
141
|
export default ClippingNode;
|
|
142
142
|
|
|
143
|
+
ClippingNode.type = /*@__PURE__*/ registerNode( 'Clipping', ClippingNode );
|
|
144
|
+
|
|
143
145
|
export const clipping = () => nodeObject( new ClippingNode() );
|
|
144
146
|
|
|
145
147
|
export const clippingAlpha = () => nodeObject( new ClippingNode( ClippingNode.ALPHA_TO_COVERAGE ) );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import TextureNode from './TextureNode.js';
|
|
2
|
-
import { reflectVector, refractVector } from './
|
|
3
|
-
import {
|
|
4
|
-
import { addNodeElement, nodeProxy, vec3 } from '../shadernode/ShaderNode.js';
|
|
3
|
+
import { reflectVector, refractVector } from './ReflectVector.js';
|
|
4
|
+
import { nodeProxy, vec3 } from '../tsl/TSLBase.js';
|
|
5
5
|
|
|
6
6
|
import { CubeReflectionMapping, CubeRefractionMapping, WebGPUCoordinateSystem } from '../../constants.js';
|
|
7
7
|
|
|
@@ -71,8 +71,6 @@ class CubeTextureNode extends TextureNode {
|
|
|
71
71
|
|
|
72
72
|
export default CubeTextureNode;
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
CubeTextureNode.type = /*@__PURE__*/ registerNode( 'CubeTexture', CubeTextureNode );
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
addNodeClass( 'CubeTextureNode', CubeTextureNode );
|
|
76
|
+
export const cubeTexture = /*@__PURE__*/ nodeProxy( CubeTextureNode );
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import Node, {
|
|
1
|
+
import Node, { registerNode } from '../core/Node.js';
|
|
2
2
|
import { varyingProperty } from '../core/PropertyNode.js';
|
|
3
3
|
import { instancedBufferAttribute, instancedDynamicBufferAttribute } from './BufferAttributeNode.js';
|
|
4
|
-
import { normalLocal } from './
|
|
5
|
-
import { positionLocal } from './
|
|
6
|
-
import { nodeProxy, vec3, mat3, mat4 } from '../
|
|
4
|
+
import { normalLocal } from './Normal.js';
|
|
5
|
+
import { positionLocal } from './Position.js';
|
|
6
|
+
import { nodeProxy, vec3, mat3, mat4 } from '../tsl/TSLBase.js';
|
|
7
7
|
import { NodeUpdateType } from '../core/constants.js';
|
|
8
8
|
import { buffer } from '../accessors/BufferNode.js';
|
|
9
9
|
import { instanceIndex } from '../core/IndexNode.js';
|
|
@@ -31,7 +31,7 @@ class InstanceNode extends Node {
|
|
|
31
31
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
setup(
|
|
34
|
+
setup( builder ) {
|
|
35
35
|
|
|
36
36
|
let instanceMatrixNode = this.instanceMatrixNode;
|
|
37
37
|
let instanceColorNode = this.instanceColorNode;
|
|
@@ -91,19 +91,23 @@ class InstanceNode extends Node {
|
|
|
91
91
|
// POSITION
|
|
92
92
|
|
|
93
93
|
const instancePosition = instanceMatrixNode.mul( positionLocal ).xyz;
|
|
94
|
+
positionLocal.assign( instancePosition );
|
|
94
95
|
|
|
95
96
|
// NORMAL
|
|
96
97
|
|
|
97
|
-
|
|
98
|
+
if ( builder.hasGeometryAttribute( 'normal' ) ) {
|
|
98
99
|
|
|
99
|
-
|
|
100
|
+
const m = mat3( instanceMatrixNode );
|
|
100
101
|
|
|
101
|
-
|
|
102
|
+
const transformedNormal = normalLocal.div( vec3( m[ 0 ].dot( m[ 0 ] ), m[ 1 ].dot( m[ 1 ] ), m[ 2 ].dot( m[ 2 ] ) ) );
|
|
102
103
|
|
|
103
|
-
|
|
104
|
+
const instanceNormal = m.mul( transformedNormal ).xyz;
|
|
104
105
|
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
// ASSIGNS
|
|
107
|
+
|
|
108
|
+
normalLocal.assign( instanceNormal );
|
|
109
|
+
|
|
110
|
+
}
|
|
107
111
|
|
|
108
112
|
// COLOR
|
|
109
113
|
|
|
@@ -135,6 +139,6 @@ class InstanceNode extends Node {
|
|
|
135
139
|
|
|
136
140
|
export default InstanceNode;
|
|
137
141
|
|
|
138
|
-
|
|
142
|
+
InstanceNode.type = /*@__PURE__*/ registerNode( 'Instance', InstanceNode );
|
|
139
143
|
|
|
140
|
-
|
|
144
|
+
export const instance = /*@__PURE__*/ nodeProxy( InstanceNode );
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import MaterialNode from './MaterialNode.js';
|
|
2
|
-
import {
|
|
3
|
-
import { nodeImmutable } from '../shadernode/ShaderNode.js';
|
|
3
|
+
import { nodeImmutable } from '../tsl/TSLBase.js';
|
|
4
4
|
|
|
5
5
|
class InstancedPointsMaterialNode extends MaterialNode {
|
|
6
6
|
|
|
@@ -16,6 +16,6 @@ InstancedPointsMaterialNode.POINT_WIDTH = 'pointWidth';
|
|
|
16
16
|
|
|
17
17
|
export default InstancedPointsMaterialNode;
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
InstancedPointsMaterialNode.type = /*@__PURE__*/ registerNode( 'InstancedPointsMaterial', InstancedPointsMaterialNode );
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
export const materialPointWidth = /*@__PURE__*/ nodeImmutable( InstancedPointsMaterialNode, InstancedPointsMaterialNode.POINT_WIDTH );
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import Node, {
|
|
1
|
+
import Node, { registerNode } from '../core/Node.js';
|
|
2
2
|
import { reference } from './ReferenceNode.js';
|
|
3
3
|
import { materialReference } from './MaterialReferenceNode.js';
|
|
4
|
-
import { normalView } from './
|
|
5
|
-
import { nodeImmutable, float, vec2, mat2 } from '../
|
|
4
|
+
import { normalView } from './Normal.js';
|
|
5
|
+
import { nodeImmutable, float, vec2, vec3, mat2 } from '../tsl/TSLBase.js';
|
|
6
6
|
import { uniform } from '../core/UniformNode.js';
|
|
7
|
+
import { normalMap } from '../display/NormalMapNode.js';
|
|
8
|
+
import { bumpMap } from '../display/BumpMapNode.js';
|
|
7
9
|
|
|
8
10
|
import { Vector2 } from '../../math/Vector2.js';
|
|
9
11
|
|
|
@@ -62,7 +64,7 @@ class MaterialNode extends Node {
|
|
|
62
64
|
|
|
63
65
|
if ( scope === MaterialNode.COLOR ) {
|
|
64
66
|
|
|
65
|
-
const colorNode = this.getColor( scope );
|
|
67
|
+
const colorNode = material.color !== undefined ? this.getColor( scope ) : vec3();
|
|
66
68
|
|
|
67
69
|
if ( material.map && material.map.isTexture === true ) {
|
|
68
70
|
|
|
@@ -175,11 +177,11 @@ class MaterialNode extends Node {
|
|
|
175
177
|
|
|
176
178
|
if ( material.normalMap ) {
|
|
177
179
|
|
|
178
|
-
node = this.getTexture( 'normal' )
|
|
180
|
+
node = normalMap( this.getTexture( 'normal' ), this.getCache( 'normalScale', 'vec2' ) );
|
|
179
181
|
|
|
180
182
|
} else if ( material.bumpMap ) {
|
|
181
183
|
|
|
182
|
-
node = this.getTexture( 'bump' ).r
|
|
184
|
+
node = bumpMap( this.getTexture( 'bump' ).r, this.getFloat( 'bumpScale' ) );
|
|
183
185
|
|
|
184
186
|
} else {
|
|
185
187
|
|
|
@@ -219,7 +221,7 @@ class MaterialNode extends Node {
|
|
|
219
221
|
|
|
220
222
|
if ( material.clearcoatNormalMap ) {
|
|
221
223
|
|
|
222
|
-
node = this.getTexture( scope )
|
|
224
|
+
node = normalMap( this.getTexture( scope ), this.getCache( scope + 'Scale', 'vec2' ) );
|
|
223
225
|
|
|
224
226
|
} else {
|
|
225
227
|
|
|
@@ -320,10 +322,6 @@ class MaterialNode extends Node {
|
|
|
320
322
|
|
|
321
323
|
node = this.getFloat( scope );
|
|
322
324
|
|
|
323
|
-
} else if ( scope === MaterialNode.REFRACTION_RATIO ) {
|
|
324
|
-
|
|
325
|
-
node = this.getFloat( scope );
|
|
326
|
-
|
|
327
325
|
} else if ( scope === MaterialNode.LIGHT_MAP ) {
|
|
328
326
|
|
|
329
327
|
node = this.getTexture( scope ).rgb.mul( this.getFloat( 'lightMapIntensity' ) );
|
|
@@ -383,51 +381,52 @@ MaterialNode.POINT_WIDTH = 'pointWidth';
|
|
|
383
381
|
MaterialNode.DISPERSION = 'dispersion';
|
|
384
382
|
MaterialNode.LIGHT_MAP = 'light';
|
|
385
383
|
MaterialNode.AO_MAP = 'ao';
|
|
386
|
-
MaterialNode.REFRACTION_RATIO = 'refractionRatio';
|
|
387
384
|
|
|
388
385
|
export default MaterialNode;
|
|
389
386
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
export const
|
|
393
|
-
export const
|
|
394
|
-
export const
|
|
395
|
-
export const
|
|
396
|
-
|
|
397
|
-
export const
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
export const
|
|
401
|
-
|
|
402
|
-
export const
|
|
403
|
-
export const
|
|
404
|
-
export const
|
|
405
|
-
export const
|
|
406
|
-
export const
|
|
407
|
-
export const
|
|
408
|
-
export const
|
|
409
|
-
export const
|
|
410
|
-
export const
|
|
411
|
-
export const
|
|
412
|
-
export const
|
|
413
|
-
export const
|
|
414
|
-
export const
|
|
415
|
-
export const
|
|
416
|
-
export const
|
|
417
|
-
export const
|
|
418
|
-
export const
|
|
419
|
-
export const
|
|
420
|
-
export const
|
|
421
|
-
export const
|
|
422
|
-
export const
|
|
423
|
-
export const
|
|
424
|
-
export const
|
|
425
|
-
export const
|
|
426
|
-
export const
|
|
427
|
-
export const
|
|
428
|
-
export const
|
|
429
|
-
export const
|
|
430
|
-
export const
|
|
387
|
+
MaterialNode.type = /*@__PURE__*/ registerNode( 'Material', MaterialNode );
|
|
388
|
+
|
|
389
|
+
export const materialAlphaTest = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.ALPHA_TEST );
|
|
390
|
+
export const materialColor = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.COLOR );
|
|
391
|
+
export const materialShininess = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.SHININESS );
|
|
392
|
+
export const materialEmissive = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.EMISSIVE );
|
|
393
|
+
export const materialOpacity = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.OPACITY );
|
|
394
|
+
export const materialSpecular = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.SPECULAR );
|
|
395
|
+
|
|
396
|
+
export const materialSpecularIntensity = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.SPECULAR_INTENSITY );
|
|
397
|
+
export const materialSpecularColor = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.SPECULAR_COLOR );
|
|
398
|
+
|
|
399
|
+
export const materialSpecularStrength = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.SPECULAR_STRENGTH );
|
|
400
|
+
export const materialReflectivity = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.REFLECTIVITY );
|
|
401
|
+
export const materialRoughness = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.ROUGHNESS );
|
|
402
|
+
export const materialMetalness = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.METALNESS );
|
|
403
|
+
export const materialNormal = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.NORMAL ).context( { getUV: null } );
|
|
404
|
+
export const materialClearcoat = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.CLEARCOAT );
|
|
405
|
+
export const materialClearcoatRoughness = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.CLEARCOAT_ROUGHNESS );
|
|
406
|
+
export const materialClearcoatNormal = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.CLEARCOAT_NORMAL ).context( { getUV: null } );
|
|
407
|
+
export const materialRotation = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.ROTATION );
|
|
408
|
+
export const materialSheen = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.SHEEN );
|
|
409
|
+
export const materialSheenRoughness = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.SHEEN_ROUGHNESS );
|
|
410
|
+
export const materialAnisotropy = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.ANISOTROPY );
|
|
411
|
+
export const materialIridescence = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.IRIDESCENCE );
|
|
412
|
+
export const materialIridescenceIOR = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.IRIDESCENCE_IOR );
|
|
413
|
+
export const materialIridescenceThickness = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.IRIDESCENCE_THICKNESS );
|
|
414
|
+
export const materialTransmission = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.TRANSMISSION );
|
|
415
|
+
export const materialThickness = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.THICKNESS );
|
|
416
|
+
export const materialIOR = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.IOR );
|
|
417
|
+
export const materialAttenuationDistance = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.ATTENUATION_DISTANCE );
|
|
418
|
+
export const materialAttenuationColor = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.ATTENUATION_COLOR );
|
|
419
|
+
export const materialLineScale = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.LINE_SCALE );
|
|
420
|
+
export const materialLineDashSize = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.LINE_DASH_SIZE );
|
|
421
|
+
export const materialLineGapSize = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.LINE_GAP_SIZE );
|
|
422
|
+
export const materialLineWidth = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.LINE_WIDTH );
|
|
423
|
+
export const materialLineDashOffset = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.LINE_DASH_OFFSET );
|
|
424
|
+
export const materialPointWidth = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.POINT_WIDTH );
|
|
425
|
+
export const materialDispersion = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.DISPERSION );
|
|
426
|
+
export const materialLightMap = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.LIGHT_MAP );
|
|
427
|
+
export const materialAOMap = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.AO_MAP );
|
|
428
|
+
export const materialRefractionRatio = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.REFRACTION_RATIO );
|
|
429
|
+
export const materialAnisotropyVector = /*@__PURE__*/ uniform( new Vector2() ).onReference( function ( frame ) {
|
|
431
430
|
|
|
432
431
|
return frame.material;
|
|
433
432
|
|
|
@@ -436,5 +435,3 @@ export const materialAnisotropyVector = uniform( new Vector2() ).onReference( fu
|
|
|
436
435
|
this.value.set( material.anisotropy * Math.cos( material.anisotropyRotation ), material.anisotropy * Math.sin( material.anisotropyRotation ) );
|
|
437
436
|
|
|
438
437
|
} );
|
|
439
|
-
|
|
440
|
-
addNodeClass( 'MaterialNode', MaterialNode );
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import ReferenceNode from './ReferenceNode.js';
|
|
2
3
|
//import { renderGroup } from '../core/UniformGroupNode.js';
|
|
3
4
|
//import { NodeUpdateType } from '../core/constants.js';
|
|
4
|
-
import {
|
|
5
|
-
import { nodeObject } from '../shadernode/ShaderNode.js';
|
|
5
|
+
import { nodeObject } from '../tsl/TSLBase.js';
|
|
6
6
|
|
|
7
7
|
class MaterialReferenceNode extends ReferenceNode {
|
|
8
8
|
|
|
@@ -14,6 +14,8 @@ class MaterialReferenceNode extends ReferenceNode {
|
|
|
14
14
|
|
|
15
15
|
//this.updateType = NodeUpdateType.RENDER;
|
|
16
16
|
|
|
17
|
+
this.isMaterialReferenceNode = true;
|
|
18
|
+
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
/*setNodeType( node ) {
|
|
@@ -36,6 +38,6 @@ class MaterialReferenceNode extends ReferenceNode {
|
|
|
36
38
|
|
|
37
39
|
export default MaterialReferenceNode;
|
|
38
40
|
|
|
39
|
-
|
|
41
|
+
MaterialReferenceNode.type = /*@__PURE__*/ registerNode( 'MaterialReference', MaterialReferenceNode );
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
export const materialReference = ( name, type, material ) => nodeObject( new MaterialReferenceNode( name, type, material ) );
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import Object3DNode from './Object3DNode.js';
|
|
2
|
-
import {
|
|
3
|
-
import { nodeImmutable } from '../shadernode/ShaderNode.js';
|
|
3
|
+
import { nodeImmutable } from '../tsl/TSLBase.js';
|
|
4
4
|
import { uniform } from '../core/UniformNode.js';
|
|
5
5
|
|
|
6
6
|
import { Matrix4 } from '../../math/Matrix4.js';
|
|
@@ -25,13 +25,13 @@ class ModelNode extends Object3DNode {
|
|
|
25
25
|
|
|
26
26
|
export default ModelNode;
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
export const modelViewMatrix = nodeImmutable( ModelNode, ModelNode.VIEW_MATRIX ).label( 'modelViewMatrix' ).temp( 'ModelViewMatrix' );
|
|
30
|
-
export const modelNormalMatrix = nodeImmutable( ModelNode, ModelNode.NORMAL_MATRIX );
|
|
31
|
-
export const modelWorldMatrix = nodeImmutable( ModelNode, ModelNode.WORLD_MATRIX );
|
|
32
|
-
export const modelPosition = nodeImmutable( ModelNode, ModelNode.POSITION );
|
|
33
|
-
export const modelScale = nodeImmutable( ModelNode, ModelNode.SCALE );
|
|
34
|
-
export const modelViewPosition = nodeImmutable( ModelNode, ModelNode.VIEW_POSITION );
|
|
35
|
-
export const modelWorldMatrixInverse = uniform( new Matrix4() ).onObjectUpdate( ( { object }, self ) => self.value.copy( object.matrixWorld ).invert() );
|
|
28
|
+
ModelNode.type = /*@__PURE__*/ registerNode( 'Model', ModelNode );
|
|
36
29
|
|
|
37
|
-
|
|
30
|
+
export const modelDirection = /*@__PURE__*/ nodeImmutable( ModelNode, ModelNode.DIRECTION );
|
|
31
|
+
export const modelViewMatrix = /*@__PURE__*/ nodeImmutable( ModelNode, ModelNode.VIEW_MATRIX ).label( 'modelViewMatrix' ).toVar( 'ModelViewMatrix' );
|
|
32
|
+
export const modelNormalMatrix = /*@__PURE__*/ nodeImmutable( ModelNode, ModelNode.NORMAL_MATRIX );
|
|
33
|
+
export const modelWorldMatrix = /*@__PURE__*/ nodeImmutable( ModelNode, ModelNode.WORLD_MATRIX );
|
|
34
|
+
export const modelPosition = /*@__PURE__*/ nodeImmutable( ModelNode, ModelNode.POSITION );
|
|
35
|
+
export const modelScale = /*@__PURE__*/ nodeImmutable( ModelNode, ModelNode.SCALE );
|
|
36
|
+
export const modelViewPosition = /*@__PURE__*/ nodeImmutable( ModelNode, ModelNode.VIEW_POSITION );
|
|
37
|
+
export const modelWorldMatrixInverse = /*@__PURE__*/ uniform( new Matrix4() ).onObjectUpdate( ( { object }, self ) => self.value.copy( object.matrixWorld ).invert() );
|