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,7 +1,7 @@
|
|
|
1
|
-
import { createNodeFromType } from '
|
|
2
|
-
import { nodeObject } from '
|
|
1
|
+
import { createNodeFromType } from '../../nodes/core/Node.js';
|
|
2
|
+
import { nodeObject } from '../../nodes/tsl/TSLBase.js';
|
|
3
3
|
|
|
4
|
-
import { Loader } from '
|
|
4
|
+
import { Loader } from '../Loader.js';
|
|
5
5
|
import { FileLoader } from '../../loaders/FileLoader.js';
|
|
6
6
|
|
|
7
7
|
class NodeLoader extends Loader {
|
|
@@ -56,7 +56,7 @@ class NodeLoader extends Loader {
|
|
|
56
56
|
|
|
57
57
|
const { uuid, type } = nodeJSON;
|
|
58
58
|
|
|
59
|
-
nodes[ uuid ] = nodeObject( createNodeFromType( type ) );
|
|
59
|
+
nodes[ uuid ] = nodeObject( createNodeFromType( type ) );
|
|
60
60
|
nodes[ uuid ].uuid = uuid;
|
|
61
61
|
|
|
62
62
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { createNodeMaterialFromType } from '../materials/Materials.js';
|
|
2
|
-
|
|
3
1
|
import { MaterialLoader } from '../../loaders/MaterialLoader.js';
|
|
2
|
+
import { createNodeMaterialFromType } from '../../materials/nodes/NodeMaterial.js';
|
|
4
3
|
|
|
5
4
|
const superFromTypeFunction = MaterialLoader.createMaterialFromType;
|
|
6
5
|
|
|
@@ -100,6 +100,10 @@ class Material extends EventDispatcher {
|
|
|
100
100
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
// onBeforeRender and onBeforeCompile only supported in WebGLRenderer
|
|
104
|
+
|
|
105
|
+
onBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {}
|
|
106
|
+
|
|
103
107
|
onBeforeCompile( /* shaderobject, renderer */ ) {}
|
|
104
108
|
|
|
105
109
|
customProgramCacheKey() {
|
|
@@ -522,13 +526,6 @@ class Material extends EventDispatcher {
|
|
|
522
526
|
|
|
523
527
|
}
|
|
524
528
|
|
|
525
|
-
onBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {
|
|
526
|
-
|
|
527
|
-
console.warn( 'Material: onBeforeRender() has been removed.' ); // @deprecated, r166
|
|
528
|
-
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
|
|
532
529
|
}
|
|
533
530
|
|
|
534
531
|
export { Material };
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import NodeMaterial, {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import { PointsMaterial } from '../../materials/PointsMaterial.js';
|
|
1
|
+
import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
|
|
2
|
+
import { property } from '../../nodes/core/PropertyNode.js';
|
|
3
|
+
import { attribute } from '../../nodes/core/AttributeNode.js';
|
|
4
|
+
import { cameraProjectionMatrix } from '../../nodes/accessors/Camera.js';
|
|
5
|
+
import { materialColor, materialOpacity, materialPointWidth } from '../../nodes/accessors/MaterialNode.js'; // or should this be a property, instead?
|
|
6
|
+
import { modelViewMatrix } from '../../nodes/accessors/ModelNode.js';
|
|
7
|
+
import { positionGeometry } from '../../nodes/accessors/Position.js';
|
|
8
|
+
import { smoothstep } from '../../nodes/math/MathNode.js';
|
|
9
|
+
import { Fn, varying, vec2, vec4 } from '../../nodes/tsl/TSLBase.js';
|
|
10
|
+
import { uv } from '../../nodes/accessors/UV.js';
|
|
11
|
+
import { viewport } from '../../nodes/display/ViewportNode.js';
|
|
12
|
+
|
|
13
|
+
import { PointsMaterial } from '../PointsMaterial.js';
|
|
15
14
|
|
|
16
15
|
const _defaultValues = /*@__PURE__*/ new PointsMaterial();
|
|
17
16
|
|
|
@@ -21,8 +20,6 @@ class InstancedPointsNodeMaterial extends NodeMaterial {
|
|
|
21
20
|
|
|
22
21
|
super();
|
|
23
22
|
|
|
24
|
-
this.normals = false;
|
|
25
|
-
|
|
26
23
|
this.lights = false;
|
|
27
24
|
|
|
28
25
|
this.useAlphaToCoverage = true;
|
|
@@ -33,6 +30,8 @@ class InstancedPointsNodeMaterial extends NodeMaterial {
|
|
|
33
30
|
|
|
34
31
|
this.pointColorNode = null;
|
|
35
32
|
|
|
33
|
+
this.pointWidthNode = null;
|
|
34
|
+
|
|
36
35
|
this.setDefaultValues( _defaultValues );
|
|
37
36
|
|
|
38
37
|
this.setupShaders();
|
|
@@ -41,17 +40,25 @@ class InstancedPointsNodeMaterial extends NodeMaterial {
|
|
|
41
40
|
|
|
42
41
|
}
|
|
43
42
|
|
|
43
|
+
setup( builder ) {
|
|
44
|
+
|
|
45
|
+
this.setupShaders();
|
|
46
|
+
|
|
47
|
+
super.setup( builder );
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
|
|
44
51
|
setupShaders() {
|
|
45
52
|
|
|
46
53
|
const useAlphaToCoverage = this.alphaToCoverage;
|
|
47
54
|
const useColor = this.useColor;
|
|
48
55
|
|
|
49
|
-
this.vertexNode =
|
|
56
|
+
this.vertexNode = Fn( () => {
|
|
50
57
|
|
|
51
58
|
//vUv = uv;
|
|
52
59
|
varying( vec2(), 'vUv' ).assign( uv() ); // @TODO: Analyze other way to do this
|
|
53
60
|
|
|
54
|
-
const instancePosition = attribute( 'instancePosition' );
|
|
61
|
+
const instancePosition = attribute( 'instancePosition' ).xyz;
|
|
55
62
|
|
|
56
63
|
// camera space
|
|
57
64
|
const mvPos = property( 'vec4', 'mvPos' );
|
|
@@ -65,7 +72,9 @@ class InstancedPointsNodeMaterial extends NodeMaterial {
|
|
|
65
72
|
// offset in ndc space
|
|
66
73
|
const offset = property( 'vec2', 'offset' );
|
|
67
74
|
offset.assign( positionGeometry.xy );
|
|
68
|
-
|
|
75
|
+
|
|
76
|
+
offset.mulAssign( this.pointWidthNode ? this.pointWidthNode : materialPointWidth );
|
|
77
|
+
|
|
69
78
|
offset.assign( offset.div( viewport.z ) );
|
|
70
79
|
offset.y.assign( offset.y.mul( aspect ) );
|
|
71
80
|
|
|
@@ -81,7 +90,7 @@ class InstancedPointsNodeMaterial extends NodeMaterial {
|
|
|
81
90
|
|
|
82
91
|
} )();
|
|
83
92
|
|
|
84
|
-
this.fragmentNode =
|
|
93
|
+
this.fragmentNode = Fn( () => {
|
|
85
94
|
|
|
86
95
|
const vUv = varying( vec2(), 'vUv' );
|
|
87
96
|
|
|
@@ -130,12 +139,12 @@ class InstancedPointsNodeMaterial extends NodeMaterial {
|
|
|
130
139
|
|
|
131
140
|
}
|
|
132
141
|
|
|
142
|
+
alpha.mulAssign( materialOpacity );
|
|
143
|
+
|
|
133
144
|
return vec4( pointColorNode, alpha );
|
|
134
145
|
|
|
135
146
|
} )();
|
|
136
147
|
|
|
137
|
-
this.needsUpdate = true;
|
|
138
|
-
|
|
139
148
|
}
|
|
140
149
|
|
|
141
150
|
get alphaToCoverage() {
|
|
@@ -149,7 +158,7 @@ class InstancedPointsNodeMaterial extends NodeMaterial {
|
|
|
149
158
|
if ( this.useAlphaToCoverage !== value ) {
|
|
150
159
|
|
|
151
160
|
this.useAlphaToCoverage = value;
|
|
152
|
-
this.
|
|
161
|
+
this.needsUpdate = true;
|
|
153
162
|
|
|
154
163
|
}
|
|
155
164
|
|
|
@@ -159,4 +168,4 @@ class InstancedPointsNodeMaterial extends NodeMaterial {
|
|
|
159
168
|
|
|
160
169
|
export default InstancedPointsNodeMaterial;
|
|
161
170
|
|
|
162
|
-
|
|
171
|
+
InstancedPointsNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'InstancedPoints', InstancedPointsNodeMaterial );
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import NodeMaterial, {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
import { LineDashedMaterial } from '../../materials/LineDashedMaterial.js';
|
|
1
|
+
import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
|
|
2
|
+
import { property, varyingProperty } from '../../nodes/core/PropertyNode.js';
|
|
3
|
+
import { attribute } from '../../nodes/core/AttributeNode.js';
|
|
4
|
+
import { cameraProjectionMatrix } from '../../nodes/accessors/Camera.js';
|
|
5
|
+
import { materialColor, materialLineScale, materialLineDashSize, materialLineGapSize, materialLineDashOffset, materialLineWidth } from '../../nodes/accessors/MaterialNode.js';
|
|
6
|
+
import { modelViewMatrix } from '../../nodes/accessors/ModelNode.js';
|
|
7
|
+
import { positionGeometry } from '../../nodes/accessors/Position.js';
|
|
8
|
+
import { mix, smoothstep } from '../../nodes/math/MathNode.js';
|
|
9
|
+
import { Fn, varying, float, vec2, vec3, vec4, If } from '../../nodes/tsl/TSLBase.js';
|
|
10
|
+
import { uv } from '../../nodes/accessors/UV.js';
|
|
11
|
+
import { viewport } from '../../nodes/display/ViewportNode.js';
|
|
12
|
+
import { dashSize, gapSize } from '../../nodes/core/PropertyNode.js';
|
|
13
|
+
|
|
14
|
+
import { LineDashedMaterial } from '../LineDashedMaterial.js';
|
|
17
15
|
|
|
18
16
|
const _defaultValues = /*@__PURE__*/ new LineDashedMaterial();
|
|
19
17
|
|
|
@@ -23,7 +21,6 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
23
21
|
|
|
24
22
|
super();
|
|
25
23
|
|
|
26
|
-
this.normals = false;
|
|
27
24
|
this.lights = false;
|
|
28
25
|
|
|
29
26
|
this.setDefaultValues( _defaultValues );
|
|
@@ -62,7 +59,7 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
62
59
|
const useDash = this.dashed;
|
|
63
60
|
const useWorldUnits = this.worldUnits;
|
|
64
61
|
|
|
65
|
-
const trimSegment =
|
|
62
|
+
const trimSegment = Fn( ( { start, end } ) => {
|
|
66
63
|
|
|
67
64
|
const a = cameraProjectionMatrix.element( 2 ).element( 2 ); // 3nd entry in 3th column
|
|
68
65
|
const b = cameraProjectionMatrix.element( 3 ).element( 2 ); // 3nd entry in 4th column
|
|
@@ -74,7 +71,7 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
74
71
|
|
|
75
72
|
} );
|
|
76
73
|
|
|
77
|
-
this.vertexNode =
|
|
74
|
+
this.vertexNode = Fn( () => {
|
|
78
75
|
|
|
79
76
|
varyingProperty( 'vec2', 'vUv' ).assign( uv() );
|
|
80
77
|
|
|
@@ -111,7 +108,7 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
111
108
|
|
|
112
109
|
end.assign( trimSegment( { start: start, end: end } ) );
|
|
113
110
|
|
|
114
|
-
} ).
|
|
111
|
+
} ).ElseIf( end.z.lessThan( 0.0 ).and( start.z.greaterThanEqual( 0.0 ) ), () => {
|
|
115
112
|
|
|
116
113
|
start.assign( trimSegment( { start: end, end: start } ) );
|
|
117
114
|
|
|
@@ -128,13 +125,13 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
128
125
|
const ndcEnd = clipEnd.xyz.div( clipEnd.w );
|
|
129
126
|
|
|
130
127
|
// direction
|
|
131
|
-
const dir = ndcEnd.xy.sub( ndcStart.xy ).
|
|
128
|
+
const dir = ndcEnd.xy.sub( ndcStart.xy ).toVar();
|
|
132
129
|
|
|
133
130
|
// account for clip-space aspect ratio
|
|
134
131
|
dir.x.assign( dir.x.mul( aspect ) );
|
|
135
132
|
dir.assign( dir.normalize() );
|
|
136
133
|
|
|
137
|
-
const clip =
|
|
134
|
+
const clip = vec4().toVar();
|
|
138
135
|
|
|
139
136
|
if ( useWorldUnits ) {
|
|
140
137
|
|
|
@@ -147,18 +144,18 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
147
144
|
|
|
148
145
|
const worldPos = varyingProperty( 'vec4', 'worldPos' );
|
|
149
146
|
|
|
150
|
-
worldPos.assign( positionGeometry.y.lessThan( 0.5 ).
|
|
147
|
+
worldPos.assign( positionGeometry.y.lessThan( 0.5 ).select( start, end ) );
|
|
151
148
|
|
|
152
149
|
// height offset
|
|
153
150
|
const hw = materialLineWidth.mul( 0.5 );
|
|
154
|
-
worldPos.addAssign( vec4( positionGeometry.x.lessThan( 0.0 ).
|
|
151
|
+
worldPos.addAssign( vec4( positionGeometry.x.lessThan( 0.0 ).select( worldUp.mul( hw ), worldUp.mul( hw ).negate() ), 0 ) );
|
|
155
152
|
|
|
156
153
|
// don't extend the line if we're rendering dashes because we
|
|
157
154
|
// won't be rendering the endcaps
|
|
158
155
|
if ( ! useDash ) {
|
|
159
156
|
|
|
160
157
|
// cap extension
|
|
161
|
-
worldPos.addAssign( vec4( positionGeometry.y.lessThan( 0.5 ).
|
|
158
|
+
worldPos.addAssign( vec4( positionGeometry.y.lessThan( 0.5 ).select( worldDir.mul( hw ).negate(), worldDir.mul( hw ) ), 0 ) );
|
|
162
159
|
|
|
163
160
|
// add width to the box
|
|
164
161
|
worldPos.addAssign( vec4( worldFwd.mul( hw ), 0 ) );
|
|
@@ -177,9 +174,9 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
177
174
|
|
|
178
175
|
// shift the depth of the projected points so the line
|
|
179
176
|
// segments overlap neatly
|
|
180
|
-
const clipPose =
|
|
177
|
+
const clipPose = vec3().toVar();
|
|
181
178
|
|
|
182
|
-
clipPose.assign( positionGeometry.y.lessThan( 0.5 ).
|
|
179
|
+
clipPose.assign( positionGeometry.y.lessThan( 0.5 ).select( ndcStart, ndcEnd ) );
|
|
183
180
|
clip.z.assign( clipPose.z.mul( clip.w ) );
|
|
184
181
|
|
|
185
182
|
} else {
|
|
@@ -193,14 +190,14 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
193
190
|
offset.x.assign( offset.x.div( aspect ) );
|
|
194
191
|
|
|
195
192
|
// sign flip
|
|
196
|
-
offset.assign( positionGeometry.x.lessThan( 0.0 ).
|
|
193
|
+
offset.assign( positionGeometry.x.lessThan( 0.0 ).select( offset.negate(), offset ) );
|
|
197
194
|
|
|
198
195
|
// endcaps
|
|
199
196
|
If( positionGeometry.y.lessThan( 0.0 ), () => {
|
|
200
197
|
|
|
201
198
|
offset.assign( offset.sub( dir ) );
|
|
202
199
|
|
|
203
|
-
} ).
|
|
200
|
+
} ).ElseIf( positionGeometry.y.greaterThan( 1.0 ), () => {
|
|
204
201
|
|
|
205
202
|
offset.assign( offset.add( dir ) );
|
|
206
203
|
|
|
@@ -213,7 +210,7 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
213
210
|
offset.assign( offset.div( viewport.w ) );
|
|
214
211
|
|
|
215
212
|
// select end
|
|
216
|
-
clip.assign( positionGeometry.y.lessThan( 0.5 ).
|
|
213
|
+
clip.assign( positionGeometry.y.lessThan( 0.5 ).select( clipStart, clipEnd ) );
|
|
217
214
|
|
|
218
215
|
// back to clip space
|
|
219
216
|
offset.assign( offset.mul( clip.w ) );
|
|
@@ -226,7 +223,7 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
226
223
|
|
|
227
224
|
} )();
|
|
228
225
|
|
|
229
|
-
const closestLineToLine =
|
|
226
|
+
const closestLineToLine = Fn( ( { p1, p2, p3, p4 } ) => {
|
|
230
227
|
|
|
231
228
|
const p13 = p1.sub( p3 );
|
|
232
229
|
const p43 = p4.sub( p3 );
|
|
@@ -249,7 +246,7 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
249
246
|
|
|
250
247
|
} );
|
|
251
248
|
|
|
252
|
-
this.fragmentNode =
|
|
249
|
+
this.fragmentNode = Fn( () => {
|
|
253
250
|
|
|
254
251
|
const vUv = varyingProperty( 'vec2', 'vUv' );
|
|
255
252
|
|
|
@@ -266,7 +263,7 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
266
263
|
const instanceDistanceStart = attribute( 'instanceDistanceStart' );
|
|
267
264
|
const instanceDistanceEnd = attribute( 'instanceDistanceEnd' );
|
|
268
265
|
|
|
269
|
-
const lineDistance = positionGeometry.y.lessThan( 0.5 ).
|
|
266
|
+
const lineDistance = positionGeometry.y.lessThan( 0.5 ).select( dashScaleNode.mul( instanceDistanceStart ), materialLineScale.mul( instanceDistanceEnd ) );
|
|
270
267
|
|
|
271
268
|
const vLineDistance = varying( lineDistance.add( materialLineDashOffset ) );
|
|
272
269
|
const vLineDistanceOffset = offsetNode ? vLineDistance.add( offsetNode ) : vLineDistance;
|
|
@@ -318,7 +315,7 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
318
315
|
if ( useAlphaToCoverage ) {
|
|
319
316
|
|
|
320
317
|
const a = vUv.x;
|
|
321
|
-
const b = vUv.y.greaterThan( 0.0 ).
|
|
318
|
+
const b = vUv.y.greaterThan( 0.0 ).select( vUv.y.sub( 1.0 ), vUv.y.add( 1.0 ) );
|
|
322
319
|
|
|
323
320
|
const len2 = a.mul( a ).add( b.mul( b ) );
|
|
324
321
|
|
|
@@ -337,7 +334,7 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
337
334
|
If( vUv.y.abs().greaterThan( 1.0 ), () => {
|
|
338
335
|
|
|
339
336
|
const a = vUv.x;
|
|
340
|
-
const b = vUv.y.greaterThan( 0.0 ).
|
|
337
|
+
const b = vUv.y.greaterThan( 0.0 ).select( vUv.y.sub( 1.0 ), vUv.y.add( 1.0 ) );
|
|
341
338
|
const len2 = a.mul( a ).add( b.mul( b ) );
|
|
342
339
|
|
|
343
340
|
len2.greaterThan( 1.0 ).discard();
|
|
@@ -361,7 +358,7 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
361
358
|
const instanceColorStart = attribute( 'instanceColorStart' );
|
|
362
359
|
const instanceColorEnd = attribute( 'instanceColorEnd' );
|
|
363
360
|
|
|
364
|
-
const instanceColor = positionGeometry.y.lessThan( 0.5 ).
|
|
361
|
+
const instanceColor = positionGeometry.y.lessThan( 0.5 ).select( instanceColorStart, instanceColorEnd );
|
|
365
362
|
|
|
366
363
|
lineColorNode = instanceColor.mul( materialColor );
|
|
367
364
|
|
|
@@ -437,4 +434,4 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
437
434
|
|
|
438
435
|
export default Line2NodeMaterial;
|
|
439
436
|
|
|
440
|
-
|
|
437
|
+
Line2NodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'Line2', Line2NodeMaterial );
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import NodeMaterial, {
|
|
1
|
+
import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
|
|
2
2
|
|
|
3
|
-
import { LineBasicMaterial } from '
|
|
3
|
+
import { LineBasicMaterial } from '../LineBasicMaterial.js';
|
|
4
4
|
|
|
5
5
|
const _defaultValues = /*@__PURE__*/ new LineBasicMaterial();
|
|
6
6
|
|
|
@@ -13,7 +13,6 @@ class LineBasicNodeMaterial extends NodeMaterial {
|
|
|
13
13
|
this.isLineBasicNodeMaterial = true;
|
|
14
14
|
|
|
15
15
|
this.lights = false;
|
|
16
|
-
this.normals = false;
|
|
17
16
|
|
|
18
17
|
this.setDefaultValues( _defaultValues );
|
|
19
18
|
|
|
@@ -25,4 +24,4 @@ class LineBasicNodeMaterial extends NodeMaterial {
|
|
|
25
24
|
|
|
26
25
|
export default LineBasicNodeMaterial;
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
LineBasicNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'LineBasic', LineBasicNodeMaterial );
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import NodeMaterial, {
|
|
2
|
-
import { attribute } from '
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { float } from '../shadernode/ShaderNode.js';
|
|
1
|
+
import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
|
|
2
|
+
import { attribute } from '../../nodes/core/AttributeNode.js';
|
|
3
|
+
import { materialLineDashSize, materialLineGapSize, materialLineScale } from '../../nodes/accessors/MaterialNode.js';
|
|
4
|
+
import { dashSize, gapSize } from '../../nodes/core/PropertyNode.js';
|
|
5
|
+
import { varying, float } from '../../nodes/tsl/TSLBase.js';
|
|
7
6
|
|
|
8
|
-
import { LineDashedMaterial } from '
|
|
7
|
+
import { LineDashedMaterial } from '../LineDashedMaterial.js';
|
|
9
8
|
|
|
10
9
|
const _defaultValues = /*@__PURE__*/ new LineDashedMaterial();
|
|
11
10
|
|
|
@@ -18,7 +17,6 @@ class LineDashedNodeMaterial extends NodeMaterial {
|
|
|
18
17
|
this.isLineDashedNodeMaterial = true;
|
|
19
18
|
|
|
20
19
|
this.lights = false;
|
|
21
|
-
this.normals = false;
|
|
22
20
|
|
|
23
21
|
this.setDefaultValues( _defaultValues );
|
|
24
22
|
|
|
@@ -52,4 +50,4 @@ class LineDashedNodeMaterial extends NodeMaterial {
|
|
|
52
50
|
|
|
53
51
|
export default LineDashedNodeMaterial;
|
|
54
52
|
|
|
55
|
-
|
|
53
|
+
LineDashedNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'LineDashed', LineDashedNodeMaterial );
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import NodeMaterial, {
|
|
2
|
-
import { materialLightMap } from '
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
|
|
2
|
+
import { materialLightMap } from '../../nodes/accessors/MaterialNode.js';
|
|
3
|
+
import BasicEnvironmentNode from '../../nodes/lighting/BasicEnvironmentNode.js';
|
|
4
|
+
import BasicLightMapNode from '../../nodes/lighting/BasicLightMapNode.js';
|
|
5
|
+
import BasicLightingModel from '../../nodes/functions/BasicLightingModel.js';
|
|
6
|
+
import { normalView } from '../../nodes/accessors/Normal.js';
|
|
7
|
+
import { diffuseColor } from '../../nodes/core/PropertyNode.js';
|
|
8
|
+
|
|
9
|
+
import { MeshBasicMaterial } from '../MeshBasicMaterial.js';
|
|
9
10
|
|
|
10
11
|
const _defaultValues = /*@__PURE__*/ new MeshBasicMaterial();
|
|
11
12
|
|
|
@@ -18,7 +19,6 @@ class MeshBasicNodeMaterial extends NodeMaterial {
|
|
|
18
19
|
this.isMeshBasicNodeMaterial = true;
|
|
19
20
|
|
|
20
21
|
this.lights = true;
|
|
21
|
-
//this.normals = false; @TODO: normals usage by context
|
|
22
22
|
|
|
23
23
|
this.setDefaultValues( _defaultValues );
|
|
24
24
|
|
|
@@ -28,7 +28,7 @@ class MeshBasicNodeMaterial extends NodeMaterial {
|
|
|
28
28
|
|
|
29
29
|
setupNormal() {
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
return normalView; // see #28839
|
|
32
32
|
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -70,4 +70,4 @@ class MeshBasicNodeMaterial extends NodeMaterial {
|
|
|
70
70
|
|
|
71
71
|
export default MeshBasicNodeMaterial;
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
MeshBasicNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshBasic', MeshBasicNodeMaterial );
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import NodeMaterial, {
|
|
2
|
-
import BasicEnvironmentNode from '
|
|
3
|
-
import PhongLightingModel from '
|
|
1
|
+
import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
|
|
2
|
+
import BasicEnvironmentNode from '../../nodes/lighting/BasicEnvironmentNode.js';
|
|
3
|
+
import PhongLightingModel from '../../nodes/functions/PhongLightingModel.js';
|
|
4
4
|
|
|
5
|
-
import { MeshLambertMaterial } from '
|
|
5
|
+
import { MeshLambertMaterial } from '../MeshLambertMaterial.js';
|
|
6
6
|
|
|
7
7
|
const _defaultValues = /*@__PURE__*/ new MeshLambertMaterial();
|
|
8
8
|
|
|
@@ -40,4 +40,4 @@ class MeshLambertNodeMaterial extends NodeMaterial {
|
|
|
40
40
|
|
|
41
41
|
export default MeshLambertNodeMaterial;
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
MeshLambertNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshLambert', MeshLambertNodeMaterial );
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import NodeMaterial, {
|
|
2
|
-
import { materialReference } from '
|
|
3
|
-
import { diffuseColor } from '
|
|
4
|
-
import { vec3 } from '
|
|
5
|
-
import { mix } from '
|
|
6
|
-
import { matcapUV } from '
|
|
1
|
+
import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
|
|
2
|
+
import { materialReference } from '../../nodes/accessors/MaterialReferenceNode.js';
|
|
3
|
+
import { diffuseColor } from '../../nodes/core/PropertyNode.js';
|
|
4
|
+
import { vec3 } from '../../nodes/tsl/TSLBase.js';
|
|
5
|
+
import { mix } from '../../nodes/math/MathNode.js';
|
|
6
|
+
import { matcapUV } from '../../nodes/utils/MatcapUVNode.js';
|
|
7
7
|
|
|
8
|
-
import { MeshMatcapMaterial } from '
|
|
8
|
+
import { MeshMatcapMaterial } from '../MeshMatcapMaterial.js';
|
|
9
9
|
|
|
10
10
|
const _defaultValues = /*@__PURE__*/ new MeshMatcapMaterial();
|
|
11
11
|
|
|
@@ -50,4 +50,4 @@ class MeshMatcapNodeMaterial extends NodeMaterial {
|
|
|
50
50
|
|
|
51
51
|
export default MeshMatcapNodeMaterial;
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
MeshMatcapNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshMatcap', MeshMatcapNodeMaterial );
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
|
|
2
|
+
import { diffuseColor } from '../../nodes/core/PropertyNode.js';
|
|
3
|
+
import { directionToColor } from '../../nodes/utils/Packing.js';
|
|
4
|
+
import { materialOpacity } from '../../nodes/accessors/MaterialNode.js';
|
|
5
|
+
import { transformedNormalView } from '../../nodes/accessors/Normal.js';
|
|
6
|
+
import { float, vec4 } from '../../nodes/tsl/TSLBase.js';
|
|
7
|
+
|
|
8
|
+
import { MeshNormalMaterial } from '../MeshNormalMaterial.js';
|
|
9
|
+
|
|
10
|
+
const _defaultValues = /*@__PURE__*/ new MeshNormalMaterial();
|
|
11
|
+
|
|
12
|
+
class MeshNormalNodeMaterial extends NodeMaterial {
|
|
13
|
+
|
|
14
|
+
constructor( parameters ) {
|
|
15
|
+
|
|
16
|
+
super();
|
|
17
|
+
|
|
18
|
+
this.lights = false;
|
|
19
|
+
|
|
20
|
+
this.isMeshNormalNodeMaterial = true;
|
|
21
|
+
|
|
22
|
+
this.setDefaultValues( _defaultValues );
|
|
23
|
+
|
|
24
|
+
this.setValues( parameters );
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
setupDiffuseColor() {
|
|
29
|
+
|
|
30
|
+
const opacityNode = this.opacityNode ? float( this.opacityNode ) : materialOpacity;
|
|
31
|
+
|
|
32
|
+
diffuseColor.assign( vec4( directionToColor( transformedNormalView ), opacityNode ) );
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default MeshNormalNodeMaterial;
|
|
39
|
+
|
|
40
|
+
MeshNormalNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshNormal', MeshNormalNodeMaterial );
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import NodeMaterial, {
|
|
2
|
-
import { shininess, specularColor } from '
|
|
3
|
-
import { materialShininess, materialSpecular } from '
|
|
4
|
-
import { float } from '
|
|
5
|
-
import BasicEnvironmentNode from '
|
|
6
|
-
import PhongLightingModel from '
|
|
1
|
+
import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
|
|
2
|
+
import { shininess, specularColor } from '../../nodes/core/PropertyNode.js';
|
|
3
|
+
import { materialShininess, materialSpecular } from '../../nodes/accessors/MaterialNode.js';
|
|
4
|
+
import { float } from '../../nodes/tsl/TSLBase.js';
|
|
5
|
+
import BasicEnvironmentNode from '../../nodes/lighting/BasicEnvironmentNode.js';
|
|
6
|
+
import PhongLightingModel from '../../nodes/functions/PhongLightingModel.js';
|
|
7
7
|
|
|
8
|
-
import { MeshPhongMaterial } from '
|
|
8
|
+
import { MeshPhongMaterial } from '../MeshPhongMaterial.js';
|
|
9
9
|
|
|
10
10
|
const _defaultValues = /*@__PURE__*/ new MeshPhongMaterial();
|
|
11
11
|
|
|
@@ -35,6 +35,7 @@ class MeshPhongNodeMaterial extends NodeMaterial {
|
|
|
35
35
|
return envNode ? new BasicEnvironmentNode( envNode ) : null;
|
|
36
36
|
|
|
37
37
|
}
|
|
38
|
+
|
|
38
39
|
setupLightingModel( /*builder*/ ) {
|
|
39
40
|
|
|
40
41
|
return new PhongLightingModel();
|
|
@@ -70,4 +71,4 @@ class MeshPhongNodeMaterial extends NodeMaterial {
|
|
|
70
71
|
|
|
71
72
|
export default MeshPhongNodeMaterial;
|
|
72
73
|
|
|
73
|
-
|
|
74
|
+
MeshPhongNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshPhong', MeshPhongNodeMaterial );
|