super-three 0.155.0 → 0.157.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 +361 -324
- package/build/three.js +361 -324
- package/build/three.min.js +2 -2
- package/build/three.module.js +354 -323
- package/build/three.module.min.js +1 -1
- package/examples/jsm/capabilities/WebGL.js +17 -0
- package/examples/jsm/controls/DragControls.js +3 -2
- package/examples/jsm/controls/OrbitControls.js +13 -5
- package/examples/jsm/csm/CSMShader.js +59 -21
- package/examples/jsm/exporters/EXRExporter.js +102 -24
- package/examples/jsm/exporters/GLTFExporter.js +1 -1
- package/examples/jsm/libs/rhino3dm/rhino3dm.js +8726 -4
- package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +8737 -4
- package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
- package/examples/jsm/libs/tween.module.js +790 -735
- package/examples/jsm/libs/utif.module.js +1644 -1558
- package/examples/jsm/lights/LightProbeGenerator.js +37 -3
- package/examples/jsm/lines/LineMaterial.js +90 -156
- package/examples/jsm/loaders/3DMLoader.js +378 -104
- package/examples/jsm/loaders/DDSLoader.js +46 -3
- package/examples/jsm/loaders/EXRLoader.js +4 -4
- package/examples/jsm/loaders/FBXLoader.js +2 -0
- package/examples/jsm/loaders/GLTFLoader.js +18 -8
- package/examples/jsm/loaders/KTX2Loader.js +126 -77
- package/examples/jsm/loaders/LDrawLoader.js +22 -16
- package/examples/jsm/loaders/LogLuvLoader.js +2 -2
- package/examples/jsm/loaders/MMDLoader.js +10 -7
- package/examples/jsm/loaders/RGBELoader.js +48 -66
- package/examples/jsm/loaders/STLLoader.js +7 -0
- package/examples/jsm/loaders/USDZLoader.js +215 -12
- package/examples/jsm/materials/MeshGouraudMaterial.js +22 -18
- package/examples/jsm/nodes/Nodes.js +8 -1
- package/examples/jsm/nodes/accessors/BitangentNode.js +1 -1
- package/examples/jsm/nodes/accessors/BufferAttributeNode.js +30 -4
- package/examples/jsm/nodes/accessors/BufferNode.js +1 -1
- package/examples/jsm/nodes/accessors/CameraNode.js +1 -1
- package/examples/jsm/nodes/accessors/CubeTextureNode.js +19 -4
- package/examples/jsm/nodes/accessors/ExtendedMaterialNode.js +4 -5
- package/examples/jsm/nodes/accessors/InstanceNode.js +2 -2
- package/examples/jsm/nodes/accessors/LineMaterialNode.js +29 -0
- package/examples/jsm/nodes/accessors/MaterialNode.js +23 -13
- package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +12 -9
- package/examples/jsm/nodes/accessors/ModelNode.js +1 -1
- package/examples/jsm/nodes/accessors/ModelViewProjectionNode.js +5 -4
- package/examples/jsm/nodes/accessors/MorphNode.js +4 -4
- package/examples/jsm/nodes/accessors/NormalNode.js +1 -1
- package/examples/jsm/nodes/accessors/Object3DNode.js +3 -3
- package/examples/jsm/nodes/accessors/PointUVNode.js +1 -1
- package/examples/jsm/nodes/accessors/PositionNode.js +1 -1
- package/examples/jsm/nodes/accessors/ReferenceNode.js +13 -7
- package/examples/jsm/nodes/accessors/ReflectVectorNode.js +2 -2
- package/examples/jsm/nodes/accessors/SceneNode.js +2 -2
- package/examples/jsm/nodes/accessors/SkinningNode.js +2 -2
- package/examples/jsm/nodes/accessors/StorageBufferNode.js +1 -1
- package/examples/jsm/nodes/accessors/TangentNode.js +1 -1
- package/examples/jsm/nodes/accessors/TextureBicubicNode.js +2 -2
- package/examples/jsm/nodes/accessors/TextureNode.js +18 -8
- package/examples/jsm/nodes/accessors/TextureSizeNode.js +2 -2
- package/examples/jsm/nodes/accessors/TextureStoreNode.js +29 -0
- package/examples/jsm/nodes/accessors/UVNode.js +1 -1
- package/examples/jsm/nodes/accessors/UserDataNode.js +2 -2
- package/examples/jsm/nodes/code/CodeNode.js +1 -1
- package/examples/jsm/nodes/code/ExpressionNode.js +1 -1
- package/examples/jsm/nodes/code/FunctionCallNode.js +1 -1
- package/examples/jsm/nodes/code/FunctionNode.js +18 -7
- package/examples/jsm/nodes/code/ScriptableNode.js +2 -2
- package/examples/jsm/nodes/code/ScriptableValueNode.js +2 -2
- package/examples/jsm/nodes/core/ArrayUniformNode.js +1 -1
- package/examples/jsm/nodes/core/AttributeNode.js +3 -3
- package/examples/jsm/nodes/core/BypassNode.js +1 -1
- package/examples/jsm/nodes/core/CacheNode.js +1 -1
- package/examples/jsm/nodes/core/ConstNode.js +1 -1
- package/examples/jsm/nodes/core/ContextNode.js +2 -2
- package/examples/jsm/nodes/core/IndexNode.js +1 -1
- package/examples/jsm/nodes/core/InputNode.js +1 -1
- package/examples/jsm/nodes/core/Node.js +45 -14
- package/examples/jsm/nodes/core/NodeBuilder.js +83 -15
- package/examples/jsm/nodes/core/NodeFrame.js +37 -14
- package/examples/jsm/nodes/core/NodeUniform.js +1 -1
- package/examples/jsm/nodes/core/OutputStructNode.js +62 -0
- package/examples/jsm/nodes/core/PropertyNode.js +3 -1
- package/examples/jsm/nodes/core/StackNode.js +5 -5
- package/examples/jsm/nodes/core/StructTypeNode.js +24 -0
- package/examples/jsm/nodes/core/TempNode.js +1 -1
- package/examples/jsm/nodes/core/UniformNode.js +3 -1
- package/examples/jsm/nodes/core/VarNode.js +1 -1
- package/examples/jsm/nodes/core/VaryingNode.js +1 -1
- package/examples/jsm/nodes/core/constants.js +1 -1
- package/examples/jsm/nodes/display/BlendModeNode.js +2 -2
- package/examples/jsm/nodes/display/BumpMapNode.js +2 -2
- package/examples/jsm/nodes/display/ColorAdjustmentNode.js +2 -2
- package/examples/jsm/nodes/display/ColorSpaceNode.js +2 -2
- package/examples/jsm/nodes/display/FrontFacingNode.js +1 -1
- package/examples/jsm/nodes/display/NormalMapNode.js +2 -2
- package/examples/jsm/nodes/display/PosterizeNode.js +2 -2
- package/examples/jsm/nodes/display/ToneMappingNode.js +2 -2
- package/examples/jsm/nodes/display/ViewportDepthNode.js +2 -2
- package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +1 -1
- package/examples/jsm/nodes/display/ViewportNode.js +21 -7
- package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +1 -1
- package/examples/jsm/nodes/display/ViewportTextureNode.js +1 -1
- package/examples/jsm/nodes/fog/FogExp2Node.js +2 -2
- package/examples/jsm/nodes/fog/FogNode.js +2 -2
- package/examples/jsm/nodes/fog/FogRangeNode.js +2 -2
- package/examples/jsm/nodes/geometry/RangeNode.js +2 -2
- package/examples/jsm/nodes/gpgpu/ComputeNode.js +1 -1
- package/examples/jsm/nodes/lighting/AONode.js +2 -2
- package/examples/jsm/nodes/lighting/AmbientLightNode.js +3 -3
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +4 -4
- package/examples/jsm/nodes/lighting/DirectionalLightNode.js +4 -4
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +2 -2
- package/examples/jsm/nodes/lighting/HemisphereLightNode.js +3 -3
- package/examples/jsm/nodes/lighting/IESSpotLightNode.js +2 -2
- package/examples/jsm/nodes/lighting/LightNode.js +2 -2
- package/examples/jsm/nodes/lighting/LightingContextNode.js +3 -3
- package/examples/jsm/nodes/lighting/LightingNode.js +1 -1
- package/examples/jsm/nodes/lighting/LightsNode.js +4 -4
- package/examples/jsm/nodes/lighting/PointLightNode.js +3 -3
- package/examples/jsm/nodes/lighting/SpotLightNode.js +4 -4
- package/examples/jsm/nodes/materials/Line2NodeMaterial.js +449 -0
- package/examples/jsm/nodes/materials/LineBasicNodeMaterial.js +1 -1
- package/examples/jsm/nodes/materials/LineDashedNodeMaterial.js +54 -0
- package/examples/jsm/nodes/materials/Materials.js +2 -0
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +1 -1
- package/examples/jsm/nodes/materials/MeshLambertNodeMaterial.js +2 -2
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +2 -2
- package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +3 -3
- package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +6 -6
- package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +3 -3
- package/examples/jsm/nodes/materials/NodeMaterial.js +39 -29
- package/examples/jsm/nodes/materials/PointsNodeMaterial.js +1 -1
- package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +2 -2
- package/examples/jsm/nodes/math/CondNode.js +1 -1
- package/examples/jsm/nodes/math/HashNode.js +34 -0
- package/examples/jsm/nodes/math/MathNode.js +2 -2
- package/examples/jsm/nodes/math/OperatorNode.js +1 -1
- package/examples/jsm/nodes/procedural/CheckerNode.js +3 -3
- package/examples/jsm/nodes/shadernode/ShaderNode.js +85 -28
- package/examples/jsm/nodes/utils/ArrayElementNode.js +1 -1
- package/examples/jsm/nodes/utils/ConvertNode.js +1 -1
- package/examples/jsm/nodes/utils/DiscardNode.js +1 -1
- package/examples/jsm/nodes/utils/EquirectUVNode.js +2 -2
- package/examples/jsm/nodes/utils/JoinNode.js +1 -1
- package/examples/jsm/nodes/utils/LoopNode.js +11 -11
- package/examples/jsm/nodes/utils/MatcapUVNode.js +2 -2
- package/examples/jsm/nodes/utils/MaxMipLevelNode.js +1 -1
- package/examples/jsm/nodes/utils/OscNode.js +2 -2
- package/examples/jsm/nodes/utils/PackingNode.js +2 -2
- package/examples/jsm/nodes/utils/RemapNode.js +2 -2
- package/examples/jsm/nodes/utils/RotateUVNode.js +2 -2
- package/examples/jsm/nodes/utils/SetNode.js +62 -0
- package/examples/jsm/nodes/utils/SpecularMIPLevelNode.js +2 -2
- package/examples/jsm/nodes/utils/SplitNode.js +2 -2
- package/examples/jsm/nodes/utils/SpriteSheetUVNode.js +2 -2
- package/examples/jsm/nodes/utils/TimerNode.js +2 -2
- package/examples/jsm/nodes/utils/TriplanarTexturesNode.js +2 -2
- package/examples/jsm/objects/Sky.js +1 -3
- package/examples/jsm/postprocessing/FilmPass.js +3 -5
- package/examples/jsm/postprocessing/OutputPass.js +3 -2
- package/examples/jsm/postprocessing/RenderPass.js +30 -12
- package/examples/jsm/postprocessing/SAOPass.js +23 -98
- package/examples/jsm/postprocessing/SSAOPass.js +10 -30
- package/examples/jsm/renderers/common/Backend.js +11 -8
- package/examples/jsm/renderers/common/Background.js +2 -2
- package/examples/jsm/renderers/common/Binding.js +6 -0
- package/examples/jsm/renderers/common/Bindings.js +4 -5
- package/examples/jsm/renderers/common/Pipelines.js +9 -9
- package/examples/jsm/renderers/common/RenderContext.js +3 -0
- package/examples/jsm/renderers/common/RenderContexts.js +26 -1
- package/examples/jsm/renderers/common/RenderList.js +12 -4
- package/examples/jsm/renderers/common/RenderObject.js +43 -15
- package/examples/jsm/renderers/common/RenderObjects.js +8 -14
- package/examples/jsm/renderers/common/Renderer.js +52 -16
- package/examples/jsm/renderers/common/SampledTexture.js +6 -3
- package/examples/jsm/renderers/common/Sampler.js +1 -1
- package/examples/jsm/renderers/common/StorageBuffer.js +1 -1
- package/examples/jsm/renderers/common/StorageTexture.js +19 -0
- package/examples/jsm/renderers/common/Textures.js +166 -21
- package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +35 -0
- package/examples/jsm/renderers/common/nodes/NodeSampledTexture.js +21 -11
- package/examples/jsm/renderers/common/nodes/NodeSampler.js +1 -7
- package/examples/jsm/renderers/common/nodes/Nodes.js +79 -18
- package/examples/jsm/renderers/webgl/WebGLBackend.js +702 -0
- package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +207 -20
- package/examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js +84 -0
- package/examples/jsm/renderers/webgl/utils/WebGLExtensions.js +26 -0
- package/examples/jsm/renderers/webgl/utils/WebGLState.js +529 -0
- package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +212 -0
- package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +242 -0
- package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +340 -0
- package/examples/jsm/renderers/{webgl → webgl-legacy}/nodes/WebGLNodeBuilder.js +4 -4
- package/examples/jsm/renderers/{webgl → webgl-legacy}/nodes/WebGLNodes.js +14 -2
- package/examples/jsm/renderers/webgpu/WebGPUBackend.js +282 -43
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +18 -2
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +93 -60
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeFunction.js +2 -2
- package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +15 -2
- package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +39 -14
- package/examples/jsm/renderers/webgpu/utils/WebGPUTexturePassUtils.js +285 -0
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +205 -284
- package/examples/jsm/renderers/webgpu/utils/WebGPUUtils.js +6 -5
- package/examples/jsm/shaders/FilmShader.js +11 -54
- package/examples/jsm/shaders/GammaCorrectionShader.js +1 -1
- package/examples/jsm/shaders/MMDToonShader.js +4 -4
- package/examples/jsm/shaders/OutputShader.js +2 -2
- package/examples/jsm/shaders/SAOShader.js +0 -13
- package/examples/jsm/shaders/SSAOShader.js +33 -26
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +6 -6
- package/examples/jsm/utils/BufferGeometryUtils.js +6 -4
- package/package.json +1 -1
- package/src/Three.js +1 -2
- package/src/animation/AnimationUtils.js +3 -20
- package/src/animation/KeyframeTrack.js +8 -8
- package/src/audio/Audio.js +6 -0
- package/src/cameras/Camera.js +1 -5
- package/src/cameras/CubeCamera.js +14 -8
- package/src/constants.js +10 -1
- package/src/core/Object3D.js +1 -14
- package/src/core/RenderTarget.js +16 -7
- package/src/core/UniformsGroup.js +2 -2
- package/src/extras/core/CurvePath.js +4 -1
- package/src/loaders/DataTextureLoader.js +0 -2
- package/src/loaders/MaterialLoader.js +1 -1
- package/src/loaders/ObjectLoader.js +6 -0
- package/src/materials/Material.js +10 -10
- package/src/math/Color.js +1 -5
- package/src/math/ColorManagement.js +82 -60
- package/src/math/Vector2.js +2 -2
- package/src/math/Vector3.js +3 -3
- package/src/math/Vector4.js +4 -4
- package/src/objects/Line.js +1 -1
- package/src/objects/Mesh.js +1 -1
- package/src/objects/Points.js +1 -1
- package/src/objects/Sprite.js +2 -2
- package/src/renderers/WebGLRenderer.js +42 -51
- package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +35 -2
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -9
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +19 -15
- package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +4 -4
- package/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.js +3 -3
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +11 -6
- package/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.js +4 -4
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +16 -16
- package/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.js +3 -3
- package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +11 -1
- package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/background.glsl.js +8 -0
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +1 -1
- package/src/renderers/shaders/UniformsUtils.js +2 -2
- package/src/renderers/webgl/WebGLBackground.js +9 -17
- package/src/renderers/webgl/WebGLLights.js +14 -3
- package/src/renderers/webgl/WebGLProgram.js +36 -5
- package/src/renderers/webgl/WebGLPrograms.js +9 -1
- package/src/renderers/webgl/WebGLTextures.js +19 -8
- package/src/renderers/webgl/WebGLUtils.js +25 -20
- package/src/scenes/Fog.js +1 -0
- package/src/scenes/FogExp2.js +1 -0
- package/src/textures/Source.js +2 -2
- package/src/textures/Texture.js +2 -2
- package/src/utils.js +9 -1
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureMipmapUtils.js +0 -163
- package/src/lights/AmbientLightProbe.js +0 -21
- package/src/lights/HemisphereLightProbe.js +0 -30
- /package/examples/jsm/renderers/{webgl → webgl-legacy}/nodes/SlotNode.js +0 -0
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
import NodeMaterial, { addNodeMaterial } from './NodeMaterial.js';
|
|
2
|
+
import { temp } from '../core/VarNode.js';
|
|
3
|
+
import { varying } from '../core/VaryingNode.js';
|
|
4
|
+
import { property } from '../core/PropertyNode.js';
|
|
5
|
+
import { attribute } from '../core/AttributeNode.js';
|
|
6
|
+
import { cameraProjectionMatrix } from '../accessors/CameraNode.js';
|
|
7
|
+
import { materialColor } from '../accessors/MaterialNode.js';
|
|
8
|
+
import { modelViewMatrix } from '../accessors/ModelNode.js';
|
|
9
|
+
import { positionGeometry } from '../accessors/PositionNode.js';
|
|
10
|
+
import { abs, mix, mod, dot, clamp, smoothstep } from '../math/MathNode.js';
|
|
11
|
+
import { tslFn, ShaderNode, float, vec2, vec3, vec4 } from '../shadernode/ShaderNode.js';
|
|
12
|
+
import { uv } from '../accessors/UVNode.js';
|
|
13
|
+
import { materialLineScale, materialLineDashSize, materialLineGapSize, materialLineDashOffset, materialLineWidth } from '../accessors/LineMaterialNode.js';
|
|
14
|
+
import { viewport } from '../display/ViewportNode.js';
|
|
15
|
+
import { dashSize, gapSize } from '../core/PropertyNode.js';
|
|
16
|
+
|
|
17
|
+
import { LineDashedMaterial } from 'three';
|
|
18
|
+
|
|
19
|
+
const defaultValues = new LineDashedMaterial();
|
|
20
|
+
|
|
21
|
+
class Line2NodeMaterial extends NodeMaterial {
|
|
22
|
+
|
|
23
|
+
constructor( params = {} ) {
|
|
24
|
+
|
|
25
|
+
super();
|
|
26
|
+
|
|
27
|
+
this.normals = false;
|
|
28
|
+
this.lights = false;
|
|
29
|
+
|
|
30
|
+
this.setDefaultValues( defaultValues );
|
|
31
|
+
|
|
32
|
+
this.useAlphaToCoverage = true;
|
|
33
|
+
this.useColor = params.vertexColors;
|
|
34
|
+
this.useDash = params.dashed;
|
|
35
|
+
this.useWorldUnits = false;
|
|
36
|
+
|
|
37
|
+
this.dashOffset = 0;
|
|
38
|
+
this.lineWidth = 1;
|
|
39
|
+
|
|
40
|
+
this.lineColorNode = null;
|
|
41
|
+
|
|
42
|
+
this.offsetNode = null;
|
|
43
|
+
this.dashScaleNode = null;
|
|
44
|
+
this.dashSizeNode = null;
|
|
45
|
+
this.gapSizeNode = null;
|
|
46
|
+
|
|
47
|
+
this.setupShaders();
|
|
48
|
+
|
|
49
|
+
this.setValues( params );
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
setupShaders() {
|
|
54
|
+
|
|
55
|
+
const useAlphaToCoverage = this.alphaToCoverage;
|
|
56
|
+
const useColor = this.useColor;
|
|
57
|
+
const useDash = this.dashed;
|
|
58
|
+
const useWorldUnits = this.worldUnits;
|
|
59
|
+
|
|
60
|
+
const trimSegment = tslFn( ( { start, end } ) => {
|
|
61
|
+
|
|
62
|
+
const a = cameraProjectionMatrix.element( 2 ).element( 2 ); // 3nd entry in 3th column
|
|
63
|
+
const b = cameraProjectionMatrix.element( 3 ).element( 2 ); // 3nd entry in 4th column
|
|
64
|
+
const nearEstimate = b.mul( -0.5 ).div( a );
|
|
65
|
+
|
|
66
|
+
const alpha = nearEstimate.sub( start.z ).div( end.z.sub( start.z ) );
|
|
67
|
+
|
|
68
|
+
return vec4( mix( start.xyz, end.xyz, alpha ), end.w );
|
|
69
|
+
|
|
70
|
+
} );
|
|
71
|
+
|
|
72
|
+
this.vertexNode = new ShaderNode( ( stack ) => {
|
|
73
|
+
|
|
74
|
+
stack.assign( varying( vec2(), 'vUv' ), uv() );
|
|
75
|
+
|
|
76
|
+
const instanceStart = attribute( 'instanceStart' );
|
|
77
|
+
const instanceEnd = attribute( 'instanceEnd' );
|
|
78
|
+
|
|
79
|
+
// camera space
|
|
80
|
+
|
|
81
|
+
const start = property( 'vec4', 'start' );
|
|
82
|
+
const end = property( 'vec4', 'end' );
|
|
83
|
+
|
|
84
|
+
stack.assign( start, modelViewMatrix.mul( vec4( instanceStart, 1.0 ) ) ); // force assignment into correct place in flow
|
|
85
|
+
stack.assign( end, modelViewMatrix.mul( vec4( instanceEnd, 1.0 ) ) );
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
if ( useWorldUnits ) {
|
|
89
|
+
|
|
90
|
+
stack.assign( varying( vec3(), 'worldStart' ), start.xyz );
|
|
91
|
+
stack.assign( varying( vec3(), 'worldEnd' ), end.xyz );
|
|
92
|
+
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const aspect = viewport.z.div( viewport.w );
|
|
96
|
+
|
|
97
|
+
// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
|
|
98
|
+
// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
|
|
99
|
+
// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
|
|
100
|
+
// perhaps there is a more elegant solution -- WestLangley
|
|
101
|
+
|
|
102
|
+
const perspective = cameraProjectionMatrix.element( 2 ).element( 3 ).equal( -1.0 ); // 4th entry in the 3rd column
|
|
103
|
+
|
|
104
|
+
stack.if( perspective, ( stack ) => {
|
|
105
|
+
|
|
106
|
+
stack.if( start.z.lessThan( 0.0 ).and( end.z.greaterThan( 0.0 ) ), ( stack ) => {
|
|
107
|
+
|
|
108
|
+
stack.assign( end, trimSegment( { start: start, end: end } ) );
|
|
109
|
+
|
|
110
|
+
} ).elseif( end.z.lessThan( 0.0 ).and( start.z.greaterThanEqual( 0.0 ) ), ( stack ) => {
|
|
111
|
+
|
|
112
|
+
stack.assign( start, trimSegment( { start: end, end: start } ) );
|
|
113
|
+
|
|
114
|
+
} );
|
|
115
|
+
|
|
116
|
+
} );
|
|
117
|
+
|
|
118
|
+
// clip space
|
|
119
|
+
const clipStart = cameraProjectionMatrix.mul( start );
|
|
120
|
+
const clipEnd = cameraProjectionMatrix.mul( end );
|
|
121
|
+
|
|
122
|
+
// ndc space
|
|
123
|
+
const ndcStart = clipStart.xyz.div( clipStart.w );
|
|
124
|
+
const ndcEnd = clipEnd.xyz.div( clipEnd.w );
|
|
125
|
+
|
|
126
|
+
// direction
|
|
127
|
+
const dir = ndcEnd.xy.sub( ndcStart.xy );
|
|
128
|
+
|
|
129
|
+
// account for clip-space aspect ratio
|
|
130
|
+
stack.assign( dir.x, dir.x.mul( aspect ) );
|
|
131
|
+
stack.assign( dir, dir.normalize() );
|
|
132
|
+
|
|
133
|
+
const clip = temp( vec4() );
|
|
134
|
+
|
|
135
|
+
if ( useWorldUnits ) {
|
|
136
|
+
|
|
137
|
+
// get the offset direction as perpendicular to the view vector
|
|
138
|
+
const worldDir = end.xyz.sub( start.xyz ).normalize();
|
|
139
|
+
|
|
140
|
+
const offset = positionGeometry.y.lessThan( 0.5 ).cond(
|
|
141
|
+
start.xyz.cross( worldDir ).normalize(),
|
|
142
|
+
end.xyz.cross( worldDir ).normalize()
|
|
143
|
+
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
// sign flip
|
|
147
|
+
stack.assign( offset, positionGeometry.x.lessThan( 0.0 ).cond( offset.negate(), offset ) );
|
|
148
|
+
|
|
149
|
+
const forwardOffset = worldDir.dot( vec3( 0.0, 0.0, 1.0 ) );
|
|
150
|
+
|
|
151
|
+
// don't extend the line if we're rendering dashes because we
|
|
152
|
+
// won't be rendering the endcaps
|
|
153
|
+
if ( ! useDash ) {
|
|
154
|
+
|
|
155
|
+
// extend the line bounds to encompass endcaps
|
|
156
|
+
stack.assign( start, start.sub( vec4( worldDir.mul( materialLineWidth ).mul( 0.5 ), 0 ) ) );
|
|
157
|
+
stack.assign( end, end.add( vec4( worldDir.mul( materialLineWidth ).mul( 0.5 ), 0 ) ) );
|
|
158
|
+
|
|
159
|
+
// shift the position of the quad so it hugs the forward edge of the line
|
|
160
|
+
stack.assign( offset, offset.sub( vec3( dir.mul( forwardOffset ), 0 ) ) );
|
|
161
|
+
stack.assign( offset.z, offset.z.add( 0.5 ) );
|
|
162
|
+
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// endcaps
|
|
166
|
+
|
|
167
|
+
stack.if( positionGeometry.y.greaterThan( 1.0 ).or( positionGeometry.y.lessThan( 0.0 ) ), ( stack ) => {
|
|
168
|
+
|
|
169
|
+
stack.assign( offset, offset.add( vec3( dir.mul( 2.0 ).mul( forwardOffset ), 0 ) ) );
|
|
170
|
+
|
|
171
|
+
} );
|
|
172
|
+
|
|
173
|
+
// adjust for linewidth
|
|
174
|
+
stack.assign( offset, offset.mul( materialLineWidth ).mul( 0.5 ) );
|
|
175
|
+
|
|
176
|
+
// set the world position
|
|
177
|
+
|
|
178
|
+
const worldPos = varying( vec4(), 'worldPos' );
|
|
179
|
+
|
|
180
|
+
stack.assign( worldPos, positionGeometry.y.lessThan( 0.5 ).cond( start, end ) );
|
|
181
|
+
stack.assign( worldPos, worldPos.add( vec4( offset, 0 ) ) );
|
|
182
|
+
|
|
183
|
+
// project the worldpos
|
|
184
|
+
stack.assign( clip, cameraProjectionMatrix.mul( worldPos ) );
|
|
185
|
+
|
|
186
|
+
// shift the depth of the projected points so the line
|
|
187
|
+
// segments overlap neatly
|
|
188
|
+
const clipPose = temp( vec3() );
|
|
189
|
+
|
|
190
|
+
stack.assign( clipPose, positionGeometry.y.lessThan( 0.5 ).cond( ndcStart, ndcEnd ) );
|
|
191
|
+
stack.assign( clip.z, clipPose.z.mul( clip.w ) );
|
|
192
|
+
|
|
193
|
+
} else {
|
|
194
|
+
|
|
195
|
+
const offset = property( 'vec2', 'offset' );
|
|
196
|
+
|
|
197
|
+
stack.assign( offset, vec2( dir.y, dir.x.negate() ) );
|
|
198
|
+
|
|
199
|
+
// undo aspect ratio adjustment
|
|
200
|
+
stack.assign( dir.x, dir.x.div( aspect ) );
|
|
201
|
+
stack.assign( offset.x, offset.x.div( aspect ) );
|
|
202
|
+
|
|
203
|
+
// sign flip
|
|
204
|
+
stack.assign( offset, positionGeometry.x.lessThan( 0.0 ).cond( offset.negate(), offset ) );
|
|
205
|
+
|
|
206
|
+
// endcaps
|
|
207
|
+
stack.if( positionGeometry.y.lessThan( 0.0 ), ( stack ) => {
|
|
208
|
+
|
|
209
|
+
stack.assign( offset, offset.sub( dir ) );
|
|
210
|
+
|
|
211
|
+
} ).elseif( positionGeometry.y.greaterThan( 1.0 ), ( stack ) => {
|
|
212
|
+
|
|
213
|
+
stack.assign( offset, offset.add( dir ) );
|
|
214
|
+
|
|
215
|
+
} );
|
|
216
|
+
|
|
217
|
+
// adjust for linewidth
|
|
218
|
+
stack.assign( offset, offset.mul( materialLineWidth ) );
|
|
219
|
+
|
|
220
|
+
// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
|
|
221
|
+
stack.assign( offset, offset.div( viewport.w ) );
|
|
222
|
+
|
|
223
|
+
// select end
|
|
224
|
+
stack.assign( clip, positionGeometry.y.lessThan( 0.5 ).cond( clipStart, clipEnd ) );
|
|
225
|
+
|
|
226
|
+
// back to clip space
|
|
227
|
+
stack.assign( offset, offset.mul( clip.w ) );
|
|
228
|
+
|
|
229
|
+
stack.assign( clip, clip.add( vec4( offset, 0, 0 ) ) );
|
|
230
|
+
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return clip;
|
|
234
|
+
|
|
235
|
+
} );
|
|
236
|
+
|
|
237
|
+
const closestLineToLine = tslFn( ( { p1, p2, p3, p4 } ) => {
|
|
238
|
+
|
|
239
|
+
const p13 = p1.sub( p3 );
|
|
240
|
+
const p43 = p4.sub( p3 );
|
|
241
|
+
|
|
242
|
+
const p21 = p2.sub( p1 );
|
|
243
|
+
|
|
244
|
+
const d1343 = dot( p13, p43 );
|
|
245
|
+
const d4321 = dot( p43, p21 );
|
|
246
|
+
const d1321 = dot( p13, p21 );
|
|
247
|
+
const d4343 = dot( p43, p43 );
|
|
248
|
+
const d2121 = dot( p21, p21 );
|
|
249
|
+
|
|
250
|
+
const denom = d2121.mul( d4343 ).sub( d4321.mul( d4321 ) );
|
|
251
|
+
const numer = d1343.mul( d4321 ).sub( d1321.mul( d4343 ) );
|
|
252
|
+
|
|
253
|
+
const mua = clamp( numer.div( denom ), 0, 1 );
|
|
254
|
+
const mub = clamp( d1343.add( d4321.mul( mua ) ).div( d4343 ), 0, 1 );
|
|
255
|
+
|
|
256
|
+
return vec2( mua, mub );
|
|
257
|
+
|
|
258
|
+
} );
|
|
259
|
+
|
|
260
|
+
this.colorNode = new ShaderNode( ( stack ) => {
|
|
261
|
+
|
|
262
|
+
const vUv = varying( vec2(), 'vUv' );
|
|
263
|
+
|
|
264
|
+
if ( useDash ) {
|
|
265
|
+
|
|
266
|
+
const offsetNode = this.offsetNode ? float( this.offsetNodeNode ) : materialLineDashOffset;
|
|
267
|
+
const dashScaleNode = this.dashScaleNode ? float( this.dashScaleNode ) : materialLineScale;
|
|
268
|
+
const dashSizeNode = this.dashSizeNode ? float( this.dashSizeNode ) : materialLineDashSize;
|
|
269
|
+
const gapSizeNode = this.dashSizeNode ? float( this.dashGapNode ) : materialLineGapSize;
|
|
270
|
+
|
|
271
|
+
stack.assign( dashSize, dashSizeNode );
|
|
272
|
+
stack.assign( gapSize, gapSizeNode );
|
|
273
|
+
|
|
274
|
+
const instanceDistanceStart = attribute( 'instanceDistanceStart' );
|
|
275
|
+
const instanceDistanceEnd = attribute( 'instanceDistanceEnd' );
|
|
276
|
+
|
|
277
|
+
const lineDistance = positionGeometry.y.lessThan( 0.5 ).cond( dashScaleNode.mul( instanceDistanceStart ), materialLineScale.mul( instanceDistanceEnd ) );
|
|
278
|
+
|
|
279
|
+
const vLineDistance = varying( lineDistance.add( materialLineDashOffset ) );
|
|
280
|
+
const vLineDistanceOffset = offsetNode ? vLineDistance.add( offsetNode ) : vLineDistance;
|
|
281
|
+
|
|
282
|
+
stack.add( vUv.y.lessThan( - 1.0 ).or( vUv.y.greaterThan( 1.0 ) ).discard() ); // discard endcaps
|
|
283
|
+
stack.add( mod( vLineDistanceOffset, dashSize.add( gapSize ) ).greaterThan( dashSize ).discard() ); // todo - FIX
|
|
284
|
+
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// force assignment into correct place in flow
|
|
288
|
+
const alpha = property( 'float', 'alpha' );
|
|
289
|
+
stack.assign( alpha, 1 );
|
|
290
|
+
|
|
291
|
+
if ( useWorldUnits ) {
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
let worldStart = varying( vec3(), 'worldStart' );
|
|
295
|
+
let worldEnd = varying( vec3(), 'worldEnd' );
|
|
296
|
+
|
|
297
|
+
// Find the closest points on the view ray and the line segment
|
|
298
|
+
const rayEnd = varying( vec4(), 'worldPos' ).xyz.normalize().mul( 1e5 );
|
|
299
|
+
const lineDir = worldEnd.sub( worldStart );
|
|
300
|
+
const params = closestLineToLine( { p1: worldStart, p2: worldEnd, p3: vec3( 0.0, 0.0, 0.0 ), p4: rayEnd } );
|
|
301
|
+
|
|
302
|
+
const p1 = worldStart.add( lineDir.mul( params.x ) );
|
|
303
|
+
const p2 = rayEnd.mul( params.y );
|
|
304
|
+
const delta = p1.sub( p2 );
|
|
305
|
+
const len = delta.length();
|
|
306
|
+
const norm = len.div( materialLineWidth );
|
|
307
|
+
|
|
308
|
+
if ( ! useDash ) {
|
|
309
|
+
|
|
310
|
+
if ( useAlphaToCoverage ) {
|
|
311
|
+
|
|
312
|
+
const dnorm = norm.fwidth();
|
|
313
|
+
stack.assign( alpha, smoothstep( dnorm.negate().add( 0.5 ), dnorm.add( 0.5 ), norm ).oneMinus() );
|
|
314
|
+
|
|
315
|
+
} else {
|
|
316
|
+
|
|
317
|
+
stack.add( norm.greaterThan( 0.5 ).discard() );
|
|
318
|
+
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
} else {
|
|
324
|
+
|
|
325
|
+
// round endcaps
|
|
326
|
+
|
|
327
|
+
if ( useAlphaToCoverage ) {
|
|
328
|
+
|
|
329
|
+
const a = vUv.x;
|
|
330
|
+
const b = vUv.y.greaterThan( 0.0 ).cond( vUv.y.sub( 1.0 ), vUv.y.add( 1.0 ) );
|
|
331
|
+
|
|
332
|
+
const len2 = a.mul( a ).add( b.mul( b ) );
|
|
333
|
+
|
|
334
|
+
// force assignment out of following 'if' statement - to avoid uniform control flow errors
|
|
335
|
+
const dlen = property( 'float', 'dlen' );
|
|
336
|
+
stack.assign( dlen, len2.fwidth() );
|
|
337
|
+
|
|
338
|
+
stack.if( abs( vUv.y ).greaterThan( 1.0 ), ( stack ) => {
|
|
339
|
+
|
|
340
|
+
stack.assign( alpha, smoothstep( dlen.oneMinus(), dlen.add( 1 ), len2 ).oneMinus() );
|
|
341
|
+
|
|
342
|
+
} );
|
|
343
|
+
|
|
344
|
+
} else {
|
|
345
|
+
|
|
346
|
+
stack.if( abs( vUv.y ).greaterThan( 1.0 ), ( stack ) => {
|
|
347
|
+
|
|
348
|
+
const a = vUv.x;
|
|
349
|
+
const b = vUv.y.greaterThan( 0.0 ).cond( vUv.y.sub( 1.0 ), vUv.y.add( 1.0 ) );
|
|
350
|
+
const len2 = a.mul( a ).add( b.mul( b ) );
|
|
351
|
+
|
|
352
|
+
stack.add( len2.greaterThan( 1.0 ).discard() );
|
|
353
|
+
|
|
354
|
+
} );
|
|
355
|
+
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
let lineColorNode;
|
|
361
|
+
|
|
362
|
+
if ( this.lineColorNode ) {
|
|
363
|
+
|
|
364
|
+
lineColorNode = this.lineColorNode;
|
|
365
|
+
|
|
366
|
+
} else {
|
|
367
|
+
|
|
368
|
+
if ( useColor ) {
|
|
369
|
+
|
|
370
|
+
const instanceColorStart = attribute( 'instanceColorStart' );
|
|
371
|
+
const instanceColorEnd = attribute( 'instanceColorEnd' );
|
|
372
|
+
|
|
373
|
+
lineColorNode = varying( positionGeometry.y.lessThan( 0.5 ).cond( instanceColorStart, instanceColorEnd ) );
|
|
374
|
+
|
|
375
|
+
} else {
|
|
376
|
+
|
|
377
|
+
lineColorNode = materialColor;
|
|
378
|
+
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
return vec4( lineColorNode, alpha );
|
|
384
|
+
|
|
385
|
+
} );
|
|
386
|
+
|
|
387
|
+
this.needsUpdate = true;
|
|
388
|
+
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
get worldUnits() {
|
|
393
|
+
|
|
394
|
+
return this.useWorldUnits;
|
|
395
|
+
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
set worldUnits( value ) {
|
|
399
|
+
|
|
400
|
+
if ( this.useWorldUnits !== value ) {
|
|
401
|
+
|
|
402
|
+
this.useWorldUnits = value;
|
|
403
|
+
this.setupShaders();
|
|
404
|
+
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
get dashed() {
|
|
411
|
+
|
|
412
|
+
return this.useDash;
|
|
413
|
+
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
set dashed( value ) {
|
|
417
|
+
|
|
418
|
+
if ( this.useDash !== value ) {
|
|
419
|
+
|
|
420
|
+
this.useDash = value;
|
|
421
|
+
this.setupShaders();
|
|
422
|
+
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
get alphaToCoverage() {
|
|
429
|
+
|
|
430
|
+
return this.useAlphaToCoverage;
|
|
431
|
+
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
set alphaToCoverage( value ) {
|
|
435
|
+
|
|
436
|
+
if ( this.useAlphaToCoverage !== value ) {
|
|
437
|
+
|
|
438
|
+
this.useAlphaToCoverage = value;
|
|
439
|
+
this.setupShaders();
|
|
440
|
+
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
export default Line2NodeMaterial;
|
|
448
|
+
|
|
449
|
+
addNodeMaterial( 'Line2NodeMaterial', Line2NodeMaterial );
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import NodeMaterial, { addNodeMaterial } from './NodeMaterial.js';
|
|
2
|
+
import { attribute } from '../core/AttributeNode.js';
|
|
3
|
+
import { varying } from '../core/VaryingNode.js';
|
|
4
|
+
import { materialLineDashSize, materialLineGapSize, materialLineScale } from '../accessors/LineMaterialNode.js';
|
|
5
|
+
import { dashSize, gapSize } from '../core/PropertyNode.js';
|
|
6
|
+
import { float } from '../shadernode/ShaderNode.js';
|
|
7
|
+
import { LineDashedMaterial } from 'three';
|
|
8
|
+
|
|
9
|
+
const defaultValues = new LineDashedMaterial();
|
|
10
|
+
|
|
11
|
+
class LineDashedNodeMaterial extends NodeMaterial {
|
|
12
|
+
|
|
13
|
+
constructor( parameters ) {
|
|
14
|
+
|
|
15
|
+
super();
|
|
16
|
+
|
|
17
|
+
this.isLineDashedNodeMaterial = true;
|
|
18
|
+
|
|
19
|
+
this.lights = false;
|
|
20
|
+
this.normals = false;
|
|
21
|
+
|
|
22
|
+
this.setDefaultValues( defaultValues );
|
|
23
|
+
|
|
24
|
+
this.offsetNode = null;
|
|
25
|
+
this.dashScaleNode = null;
|
|
26
|
+
this.dashSizeNode = null;
|
|
27
|
+
this.gapSizeNode = null;
|
|
28
|
+
|
|
29
|
+
this.setValues( parameters );
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
setupVariants( { stack } ) {
|
|
34
|
+
|
|
35
|
+
const offsetNode = this.offsetNode;
|
|
36
|
+
const dashScaleNode = this.dashScaleNode ? float( this.dashScaleNode ) : materialLineScale;
|
|
37
|
+
const dashSizeNode = this.dashSizeNode ? float( this.dashSizeNode ) : materialLineDashSize;
|
|
38
|
+
const gapSizeNode = this.dashSizeNode ? float( this.dashGapNode ) : materialLineGapSize;
|
|
39
|
+
|
|
40
|
+
stack.assign( dashSize, dashSizeNode );
|
|
41
|
+
stack.assign( gapSize, gapSizeNode );
|
|
42
|
+
|
|
43
|
+
const vLineDistance = varying( attribute( 'lineDistance' ).mul( dashScaleNode ) );
|
|
44
|
+
const vLineDistanceOffset = offsetNode ? vLineDistance.add( offsetNode ) : vLineDistance;
|
|
45
|
+
|
|
46
|
+
stack.add( vLineDistanceOffset.mod( dashSize.add( gapSize ) ).greaterThan( dashSize ).discard() );
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default LineDashedNodeMaterial;
|
|
53
|
+
|
|
54
|
+
addNodeMaterial( 'LineDashedNodeMaterial', LineDashedNodeMaterial );
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
export { default as NodeMaterial, addNodeMaterial, createNodeMaterialFromType } from './NodeMaterial.js';
|
|
4
4
|
export { default as LineBasicNodeMaterial } from './LineBasicNodeMaterial.js';
|
|
5
|
+
export { default as LineDashedNodeMaterial } from './LineDashedNodeMaterial.js';
|
|
6
|
+
export { default as Line2NodeMaterial } from './Line2NodeMaterial.js';
|
|
5
7
|
export { default as MeshNormalNodeMaterial } from './MeshNormalNodeMaterial.js';
|
|
6
8
|
export { default as MeshBasicNodeMaterial } from './MeshBasicNodeMaterial.js';
|
|
7
9
|
export { default as MeshLambertNodeMaterial } from './MeshLambertNodeMaterial.js';
|
|
@@ -21,7 +21,7 @@ class MeshLambertNodeMaterial extends NodeMaterial {
|
|
|
21
21
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
setupLightingModel( /*builder*/ ) {
|
|
25
25
|
|
|
26
26
|
return new PhongLightingModel( false ); // ( specular ) -> force lambert
|
|
27
27
|
|
|
@@ -31,4 +31,4 @@ class MeshLambertNodeMaterial extends NodeMaterial {
|
|
|
31
31
|
|
|
32
32
|
export default MeshLambertNodeMaterial;
|
|
33
33
|
|
|
34
|
-
addNodeMaterial( MeshLambertNodeMaterial );
|
|
34
|
+
addNodeMaterial( 'MeshLambertNodeMaterial', MeshLambertNodeMaterial );
|
|
@@ -25,7 +25,7 @@ class MeshNormalNodeMaterial extends NodeMaterial {
|
|
|
25
25
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
setupDiffuseColor( { stack } ) {
|
|
29
29
|
|
|
30
30
|
const opacityNode = this.opacityNode ? float( this.opacityNode ) : materialOpacity;
|
|
31
31
|
|
|
@@ -37,4 +37,4 @@ class MeshNormalNodeMaterial extends NodeMaterial {
|
|
|
37
37
|
|
|
38
38
|
export default MeshNormalNodeMaterial;
|
|
39
39
|
|
|
40
|
-
addNodeMaterial( MeshNormalNodeMaterial );
|
|
40
|
+
addNodeMaterial( 'MeshNormalNodeMaterial', MeshNormalNodeMaterial );
|
|
@@ -27,13 +27,13 @@ class MeshPhongNodeMaterial extends NodeMaterial {
|
|
|
27
27
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
setupLightingModel( /*builder*/ ) {
|
|
31
31
|
|
|
32
32
|
return new PhongLightingModel();
|
|
33
33
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
setupVariants( { stack } ) {
|
|
37
37
|
|
|
38
38
|
// SHININESS
|
|
39
39
|
|
|
@@ -62,4 +62,4 @@ class MeshPhongNodeMaterial extends NodeMaterial {
|
|
|
62
62
|
|
|
63
63
|
export default MeshPhongNodeMaterial;
|
|
64
64
|
|
|
65
|
-
addNodeMaterial( MeshPhongNodeMaterial );
|
|
65
|
+
addNodeMaterial( 'MeshPhongNodeMaterial', MeshPhongNodeMaterial );
|
|
@@ -44,15 +44,15 @@ class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
|
|
|
44
44
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
setupLightingModel( /*builder*/ ) {
|
|
48
48
|
|
|
49
49
|
return new PhysicalLightingModel(); // @TODO: Optimize shader using parameters.
|
|
50
50
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
setupVariants( builder ) {
|
|
54
54
|
|
|
55
|
-
super.
|
|
55
|
+
super.setupVariants( builder );
|
|
56
56
|
|
|
57
57
|
const { stack } = builder;
|
|
58
58
|
|
|
@@ -84,9 +84,9 @@ class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
|
|
|
84
84
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
setupNormal( builder ) {
|
|
88
88
|
|
|
89
|
-
super.
|
|
89
|
+
super.setupNormal( builder );
|
|
90
90
|
|
|
91
91
|
// CLEARCOAT NORMAL
|
|
92
92
|
|
|
@@ -125,4 +125,4 @@ class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
|
|
|
125
125
|
|
|
126
126
|
export default MeshPhysicalNodeMaterial;
|
|
127
127
|
|
|
128
|
-
addNodeMaterial( MeshPhysicalNodeMaterial );
|
|
128
|
+
addNodeMaterial( 'MeshPhysicalNodeMaterial', MeshPhysicalNodeMaterial );
|
|
@@ -29,13 +29,13 @@ class MeshStandardNodeMaterial extends NodeMaterial {
|
|
|
29
29
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
setupLightingModel( /*builder*/ ) {
|
|
33
33
|
|
|
34
34
|
return new PhysicalLightingModel( false, false ); // ( clearcoat, sheen ) -> standard
|
|
35
35
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
setupVariants( { stack } ) {
|
|
39
39
|
|
|
40
40
|
// METALNESS
|
|
41
41
|
|
|
@@ -77,4 +77,4 @@ class MeshStandardNodeMaterial extends NodeMaterial {
|
|
|
77
77
|
|
|
78
78
|
export default MeshStandardNodeMaterial;
|
|
79
79
|
|
|
80
|
-
addNodeMaterial( MeshStandardNodeMaterial );
|
|
80
|
+
addNodeMaterial( 'MeshStandardNodeMaterial', MeshStandardNodeMaterial );
|