super-three 0.163.0 → 0.165.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/build/three.cjs +1127 -452
- package/build/three.module.js +1127 -452
- package/build/three.module.min.js +2 -2
- package/examples/jsm/animation/CCDIKSolver.js +4 -2
- package/examples/jsm/controls/TransformControls.js +1 -1
- package/examples/jsm/environments/RoomEnvironment.js +1 -5
- package/examples/jsm/exporters/GLTFExporter.js +45 -1
- package/examples/jsm/exporters/USDZExporter.js +13 -5
- package/examples/jsm/helpers/ViewHelper.js +32 -67
- package/examples/jsm/libs/draco/README.md +2 -2
- package/examples/jsm/libs/tween.module.js +75 -64
- package/examples/jsm/lines/LineMaterial.js +1 -15
- package/examples/jsm/lines/LineSegments2.js +15 -0
- package/examples/jsm/lines/Wireframe.js +16 -1
- package/examples/jsm/loaders/DRACOLoader.js +1 -1
- package/examples/jsm/loaders/EXRLoader.js +283 -99
- package/examples/jsm/loaders/FBXLoader.js +24 -13
- package/examples/jsm/loaders/GLTFLoader.js +55 -0
- package/examples/jsm/loaders/KTX2Loader.js +3 -6
- package/examples/jsm/loaders/LDrawLoader.js +3 -2
- package/examples/jsm/loaders/MMDLoader.js +31 -12
- package/examples/jsm/loaders/VRMLLoader.js +1 -1
- package/examples/jsm/loaders/lwo/IFFParser.js +8 -5
- package/examples/jsm/materials/MeshGouraudMaterial.js +7 -1
- package/examples/jsm/math/Octree.js +26 -20
- package/examples/jsm/modifiers/CurveModifier.js +11 -9
- package/examples/jsm/nodes/Nodes.js +15 -13
- package/examples/jsm/nodes/accessors/AccessorsUtils.js +16 -1
- package/examples/jsm/nodes/accessors/BitangentNode.js +7 -83
- package/examples/jsm/nodes/accessors/BufferNode.js +6 -0
- package/examples/jsm/nodes/accessors/CameraNode.js +12 -119
- package/examples/jsm/nodes/accessors/ClippingNode.js +3 -2
- package/examples/jsm/nodes/accessors/MaterialNode.js +109 -3
- package/examples/jsm/nodes/accessors/ModelNode.js +3 -0
- package/examples/jsm/nodes/accessors/NormalNode.js +9 -101
- package/examples/jsm/nodes/accessors/PositionNode.js +6 -100
- package/examples/jsm/nodes/accessors/ReferenceNode.js +6 -0
- package/examples/jsm/nodes/accessors/ReflectVectorNode.js +2 -31
- package/examples/jsm/nodes/accessors/StorageBufferNode.js +9 -0
- package/examples/jsm/nodes/accessors/{TextureStoreNode.js → StorageTextureNode.js} +19 -6
- package/examples/jsm/nodes/accessors/TangentNode.js +11 -97
- package/examples/jsm/nodes/accessors/Texture3DNode.js +100 -0
- package/examples/jsm/nodes/accessors/TextureNode.js +21 -3
- package/examples/jsm/nodes/accessors/TextureSizeNode.js +1 -1
- package/examples/jsm/nodes/accessors/UVNode.js +2 -46
- package/examples/jsm/nodes/code/FunctionNode.js +0 -8
- package/examples/jsm/nodes/core/AttributeNode.js +15 -3
- package/examples/jsm/nodes/core/ContextNode.js +6 -0
- package/examples/jsm/nodes/core/Node.js +23 -2
- package/examples/jsm/nodes/core/NodeBuilder.js +25 -18
- package/examples/jsm/nodes/core/NodeKeywords.js +1 -1
- package/examples/jsm/nodes/core/OutputStructNode.js +3 -6
- package/examples/jsm/nodes/core/PropertyNode.js +11 -0
- package/examples/jsm/nodes/core/VaryingNode.js +40 -9
- package/examples/jsm/nodes/display/AfterImageNode.js +14 -2
- package/examples/jsm/nodes/display/BumpMapNode.js +7 -26
- package/examples/jsm/nodes/display/FrontFacingNode.js +13 -0
- package/examples/jsm/nodes/display/PassNode.js +3 -1
- package/examples/jsm/nodes/display/ViewportDepthNode.js +1 -1
- package/examples/jsm/nodes/display/ViewportNode.js +5 -3
- package/examples/jsm/nodes/display/ViewportTextureNode.js +4 -1
- package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +26 -7
- package/examples/jsm/nodes/functions/BSDF/D_GGX_Anisotropic.js +28 -0
- package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +1 -3
- package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +29 -0
- package/examples/jsm/nodes/functions/PhongLightingModel.js +1 -1
- package/examples/jsm/nodes/functions/PhysicalLightingModel.js +210 -12
- package/examples/jsm/nodes/functions/ShadowMaskModel.js +31 -0
- package/examples/jsm/nodes/functions/ToonLightingModel.js +49 -0
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +20 -5
- package/examples/jsm/nodes/lighting/DirectionalLightNode.js +2 -1
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +11 -2
- package/examples/jsm/nodes/lighting/IrradianceNode.js +24 -0
- package/examples/jsm/nodes/lighting/LightsNode.js +28 -1
- package/examples/jsm/nodes/lighting/PointLightNode.js +2 -1
- package/examples/jsm/nodes/lighting/SpotLightNode.js +2 -1
- package/examples/jsm/nodes/materials/Line2NodeMaterial.js +11 -7
- package/examples/jsm/nodes/materials/Materials.js +4 -0
- package/examples/jsm/nodes/materials/MeshMatcapNodeMaterial.js +52 -0
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +0 -2
- package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +2 -2
- package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +94 -6
- package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +11 -4
- package/examples/jsm/nodes/materials/MeshToonNodeMaterial.js +34 -0
- package/examples/jsm/nodes/materials/NodeMaterial.js +43 -45
- package/examples/jsm/nodes/materials/ShadowNodeMaterial.js +34 -0
- package/examples/jsm/nodes/materials/VolumeNodeMaterial.js +106 -0
- package/examples/jsm/nodes/math/HashNode.js +2 -2
- package/examples/jsm/nodes/pmrem/PMREMUtils.js +1 -1
- package/examples/jsm/nodes/shadernode/ShaderNode.js +57 -41
- package/examples/jsm/nodes/utils/ArrayElementNode.js +1 -1
- package/examples/jsm/nodes/utils/MatcapUVNode.js +1 -1
- package/examples/jsm/nodes/utils/TimerNode.js +1 -1
- package/examples/jsm/objects/Lensflare.js +2 -2
- package/examples/jsm/physics/JoltPhysics.js +281 -0
- package/examples/jsm/postprocessing/RenderPass.js +1 -1
- package/examples/jsm/postprocessing/RenderTransitionPass.js +193 -0
- package/examples/jsm/renderers/CSS2DRenderer.js +25 -5
- package/examples/jsm/renderers/CSS3DRenderer.js +24 -3
- package/examples/jsm/renderers/common/Attributes.js +2 -0
- package/examples/jsm/renderers/common/Background.js +3 -3
- package/examples/jsm/renderers/common/Bindings.js +17 -0
- package/examples/jsm/renderers/common/ChainMap.js +18 -48
- package/examples/jsm/renderers/common/ClippingContext.js +5 -5
- package/examples/jsm/renderers/common/Pipelines.js +2 -2
- package/examples/jsm/renderers/common/RenderBundle.js +18 -0
- package/examples/jsm/renderers/common/RenderBundles.js +38 -0
- package/examples/jsm/renderers/common/RenderList.js +10 -1
- package/examples/jsm/renderers/common/RenderObject.js +49 -1
- package/examples/jsm/renderers/common/Renderer.js +268 -25
- package/examples/jsm/renderers/common/Textures.js +1 -1
- package/examples/jsm/renderers/common/Uniform.js +1 -1
- package/examples/jsm/renderers/common/extras/PMREMGenerator.js +13 -17
- package/examples/jsm/renderers/common/nodes/NodeSampledTexture.js +18 -4
- package/examples/jsm/renderers/common/nodes/NodeSampler.js +6 -0
- package/examples/jsm/renderers/common/nodes/Nodes.js +31 -47
- package/examples/jsm/renderers/webgl/WebGLBackend.js +7 -21
- package/examples/jsm/renderers/webgl/WebGLBufferRenderer.js +5 -1
- package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +23 -5
- package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +114 -13
- package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +3 -21
- package/examples/jsm/renderers/webgpu/WebGPUBackend.js +80 -46
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +85 -12
- package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +4 -1
- package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +10 -1
- package/examples/jsm/renderers/webgpu/utils/WebGPUConstants.js +6 -0
- package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +62 -19
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +62 -3
- package/examples/jsm/transpiler/GLSLDecoder.js +1 -1
- package/examples/jsm/transpiler/ShaderToyDecoder.js +1 -1
- package/examples/jsm/utils/BufferGeometryUtils.js +18 -16
- package/examples/jsm/utils/GPUStatsPanel.js +2 -0
- package/examples/jsm/utils/SceneUtils.js +60 -1
- package/examples/jsm/utils/SortUtils.js +8 -5
- package/examples/jsm/webxr/OculusHandModel.js +3 -2
- package/examples/jsm/webxr/XRHandModelFactory.js +4 -2
- package/package.json +3 -2
- package/src/animation/tracks/BooleanKeyframeTrack.js +10 -1
- package/src/animation/tracks/QuaternionKeyframeTrack.js +1 -2
- package/src/animation/tracks/StringKeyframeTrack.js +10 -1
- package/src/constants.js +1 -1
- package/src/core/Object3D.js +2 -0
- package/src/core/Raycaster.js +6 -2
- package/src/core/RenderTarget.js +8 -0
- package/src/extras/PMREMGenerator.js +12 -11
- package/src/loaders/FileLoader.js +5 -1
- package/src/loaders/LoaderUtils.js +3 -1
- package/src/loaders/MaterialLoader.js +1 -0
- package/src/loaders/ObjectLoader.js +1 -0
- package/src/materials/Material.js +2 -0
- package/src/materials/MeshPhysicalMaterial.js +20 -0
- package/src/objects/BatchedMesh.js +114 -1
- package/src/objects/Line.js +66 -43
- package/src/renderers/WebGLRenderer.js +371 -109
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +15 -0
- package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +9 -1
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +8 -22
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +1 -0
- package/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +3 -14
- package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +10 -31
- package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +3 -23
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +17 -9
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +47 -13
- package/src/renderers/shaders/ShaderChunk.js +0 -2
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +4 -0
- package/src/renderers/shaders/ShaderLib.js +1 -0
- package/src/renderers/webgl/WebGLBackground.js +24 -3
- package/src/renderers/webgl/WebGLBufferRenderer.js +36 -0
- package/src/renderers/webgl/WebGLCapabilities.js +33 -1
- package/src/renderers/webgl/WebGLExtensions.js +3 -1
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +36 -0
- package/src/renderers/webgl/WebGLLights.js +9 -12
- package/src/renderers/webgl/WebGLMaterials.js +7 -5
- package/src/renderers/webgl/WebGLMorphtargets.js +1 -2
- package/src/renderers/webgl/WebGLProgram.js +5 -36
- package/src/renderers/webgl/WebGLPrograms.js +19 -14
- package/src/renderers/webgl/WebGLRenderStates.js +8 -4
- package/src/renderers/webgl/WebGLShadowMap.js +25 -25
- package/src/renderers/webgl/WebGLTextures.js +206 -129
- package/src/renderers/webgl/WebGLUtils.js +3 -21
- package/src/renderers/webxr/WebXRDepthSensing.js +3 -3
- package/src/renderers/webxr/WebXRManager.js +8 -6
- package/src/textures/CompressedArrayTexture.js +14 -0
- package/src/textures/DataArrayTexture.js +14 -0
- package/src/textures/DepthTexture.js +1 -3
- package/src/utils.js +30 -1
- package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +0 -318
- package/examples/jsm/renderers/webgl-legacy/nodes/SlotNode.js +0 -26
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +0 -792
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.js +0 -51
- package/src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl.js +0 -10
|
@@ -1,89 +1,13 @@
|
|
|
1
|
-
import Node, { addNodeClass } from '../core/Node.js';
|
|
2
1
|
import { varying } from '../core/VaryingNode.js';
|
|
3
|
-
import { normalize } from '../math/MathNode.js';
|
|
4
2
|
import { cameraViewMatrix } from './CameraNode.js';
|
|
5
3
|
import { normalGeometry, normalLocal, normalView, normalWorld, transformedNormalView } from './NormalNode.js';
|
|
6
4
|
import { tangentGeometry, tangentLocal, tangentView, tangentWorld, transformedTangentView } from './TangentNode.js';
|
|
7
|
-
import { nodeImmutable } from '../shadernode/ShaderNode.js';
|
|
8
5
|
|
|
9
|
-
|
|
6
|
+
const getBitangent = ( crossNormalTangent ) => crossNormalTangent.mul( tangentGeometry.w ).xyz;
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
getHash( /*builder*/ ) {
|
|
20
|
-
|
|
21
|
-
return `bitangent-${this.scope}`;
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
generate( builder ) {
|
|
26
|
-
|
|
27
|
-
const scope = this.scope;
|
|
28
|
-
|
|
29
|
-
let crossNormalTangent;
|
|
30
|
-
|
|
31
|
-
if ( scope === BitangentNode.GEOMETRY ) {
|
|
32
|
-
|
|
33
|
-
crossNormalTangent = normalGeometry.cross( tangentGeometry );
|
|
34
|
-
|
|
35
|
-
} else if ( scope === BitangentNode.LOCAL ) {
|
|
36
|
-
|
|
37
|
-
crossNormalTangent = normalLocal.cross( tangentLocal );
|
|
38
|
-
|
|
39
|
-
} else if ( scope === BitangentNode.VIEW ) {
|
|
40
|
-
|
|
41
|
-
crossNormalTangent = normalView.cross( tangentView );
|
|
42
|
-
|
|
43
|
-
} else if ( scope === BitangentNode.WORLD ) {
|
|
44
|
-
|
|
45
|
-
crossNormalTangent = normalWorld.cross( tangentWorld );
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const vertexNode = crossNormalTangent.mul( tangentGeometry.w ).xyz;
|
|
50
|
-
|
|
51
|
-
const outputNode = normalize( varying( vertexNode ) );
|
|
52
|
-
|
|
53
|
-
return outputNode.build( builder, this.getNodeType( builder ) );
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
serialize( data ) {
|
|
58
|
-
|
|
59
|
-
super.serialize( data );
|
|
60
|
-
|
|
61
|
-
data.scope = this.scope;
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
deserialize( data ) {
|
|
66
|
-
|
|
67
|
-
super.deserialize( data );
|
|
68
|
-
|
|
69
|
-
this.scope = data.scope;
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
BitangentNode.GEOMETRY = 'geometry';
|
|
76
|
-
BitangentNode.LOCAL = 'local';
|
|
77
|
-
BitangentNode.VIEW = 'view';
|
|
78
|
-
BitangentNode.WORLD = 'world';
|
|
79
|
-
|
|
80
|
-
export default BitangentNode;
|
|
81
|
-
|
|
82
|
-
export const bitangentGeometry = nodeImmutable( BitangentNode, BitangentNode.GEOMETRY );
|
|
83
|
-
export const bitangentLocal = nodeImmutable( BitangentNode, BitangentNode.LOCAL );
|
|
84
|
-
export const bitangentView = nodeImmutable( BitangentNode, BitangentNode.VIEW );
|
|
85
|
-
export const bitangentWorld = nodeImmutable( BitangentNode, BitangentNode.WORLD );
|
|
86
|
-
export const transformedBitangentView = normalize( transformedNormalView.cross( transformedTangentView ).mul( tangentGeometry.w ) );
|
|
87
|
-
export const transformedBitangentWorld = normalize( transformedBitangentView.transformDirection( cameraViewMatrix ) );
|
|
88
|
-
|
|
89
|
-
addNodeClass( 'BitangentNode', BitangentNode );
|
|
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,119 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
super( scope );
|
|
14
|
-
|
|
15
|
-
this.updateType = NodeUpdateType.RENDER;
|
|
16
|
-
|
|
17
|
-
//this._uniformNode.groupNode = cameraGroup;
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
getNodeType( builder ) {
|
|
22
|
-
|
|
23
|
-
const scope = this.scope;
|
|
24
|
-
|
|
25
|
-
if ( scope === CameraNode.PROJECTION_MATRIX || scope === CameraNode.PROJECTION_MATRIX_INVERSE ) {
|
|
26
|
-
|
|
27
|
-
return 'mat4';
|
|
28
|
-
|
|
29
|
-
} else if ( scope === CameraNode.NEAR || scope === CameraNode.FAR || scope === CameraNode.LOG_DEPTH ) {
|
|
30
|
-
|
|
31
|
-
return 'float';
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return super.getNodeType( builder );
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
update( frame ) {
|
|
40
|
-
|
|
41
|
-
const camera = frame.camera;
|
|
42
|
-
const uniformNode = this._uniformNode;
|
|
43
|
-
const scope = this.scope;
|
|
44
|
-
|
|
45
|
-
//cameraGroup.needsUpdate = true;
|
|
46
|
-
|
|
47
|
-
if ( scope === CameraNode.VIEW_MATRIX ) {
|
|
48
|
-
|
|
49
|
-
uniformNode.value = camera.matrixWorldInverse;
|
|
50
|
-
|
|
51
|
-
} else if ( scope === CameraNode.PROJECTION_MATRIX ) {
|
|
52
|
-
|
|
53
|
-
uniformNode.value = camera.projectionMatrix;
|
|
54
|
-
|
|
55
|
-
} else if ( scope === CameraNode.PROJECTION_MATRIX_INVERSE ) {
|
|
56
|
-
|
|
57
|
-
uniformNode.value = camera.projectionMatrixInverse;
|
|
58
|
-
|
|
59
|
-
} else if ( scope === CameraNode.NEAR ) {
|
|
60
|
-
|
|
61
|
-
uniformNode.value = camera.near;
|
|
62
|
-
|
|
63
|
-
} else if ( scope === CameraNode.FAR ) {
|
|
64
|
-
|
|
65
|
-
uniformNode.value = camera.far;
|
|
66
|
-
|
|
67
|
-
} else if ( scope === CameraNode.LOG_DEPTH ) {
|
|
68
|
-
|
|
69
|
-
uniformNode.value = 2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 );
|
|
70
|
-
|
|
71
|
-
} else {
|
|
72
|
-
|
|
73
|
-
this.object3d = camera;
|
|
74
|
-
|
|
75
|
-
super.update( frame );
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
generate( builder ) {
|
|
82
|
-
|
|
83
|
-
const scope = this.scope;
|
|
84
|
-
|
|
85
|
-
if ( scope === CameraNode.PROJECTION_MATRIX || scope === CameraNode.PROJECTION_MATRIX_INVERSE ) {
|
|
86
|
-
|
|
87
|
-
this._uniformNode.nodeType = 'mat4';
|
|
88
|
-
|
|
89
|
-
} else if ( scope === CameraNode.NEAR || scope === CameraNode.FAR || scope === CameraNode.LOG_DEPTH ) {
|
|
90
|
-
|
|
91
|
-
this._uniformNode.nodeType = 'float';
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return super.generate( builder );
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
CameraNode.PROJECTION_MATRIX = 'projectionMatrix';
|
|
102
|
-
CameraNode.PROJECTION_MATRIX_INVERSE = 'projectionMatrixInverse';
|
|
103
|
-
CameraNode.NEAR = 'near';
|
|
104
|
-
CameraNode.FAR = 'far';
|
|
105
|
-
CameraNode.LOG_DEPTH = 'logDepth';
|
|
106
|
-
|
|
107
|
-
export default CameraNode;
|
|
108
|
-
|
|
109
|
-
export const cameraProjectionMatrix = nodeImmutable( CameraNode, CameraNode.PROJECTION_MATRIX );
|
|
110
|
-
export const cameraProjectionMatrixInverse = nodeImmutable( CameraNode, CameraNode.PROJECTION_MATRIX_INVERSE );
|
|
111
|
-
export const cameraNear = nodeImmutable( CameraNode, CameraNode.NEAR );
|
|
112
|
-
export const cameraFar = nodeImmutable( CameraNode, CameraNode.FAR );
|
|
113
|
-
export const cameraLogDepth = nodeImmutable( CameraNode, CameraNode.LOG_DEPTH );
|
|
114
|
-
export const cameraViewMatrix = nodeImmutable( CameraNode, CameraNode.VIEW_MATRIX );
|
|
115
|
-
export const cameraNormalMatrix = nodeImmutable( CameraNode, CameraNode.NORMAL_MATRIX );
|
|
116
|
-
export const cameraWorldMatrix = nodeImmutable( CameraNode, CameraNode.WORLD_MATRIX );
|
|
117
|
-
export const cameraPosition = nodeImmutable( CameraNode, CameraNode.POSITION );
|
|
118
|
-
|
|
119
|
-
addNodeClass( 'CameraNode', CameraNode );
|
|
1
|
+
import { uniform } from '../core/UniformNode.js';
|
|
2
|
+
import { Vector3 } from 'three';
|
|
3
|
+
|
|
4
|
+
export const cameraNear = /*#__PURE__*/ uniform( 'float' ).onRenderUpdate( ( { camera } ) => camera.near );
|
|
5
|
+
export const cameraFar = /*#__PURE__*/ uniform( 'float' ).onRenderUpdate( ( { camera } ) => camera.far );
|
|
6
|
+
export const cameraLogDepth = /*#__PURE__*/ uniform( 'float' ).onRenderUpdate( ( { camera } ) => 2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );
|
|
7
|
+
export const cameraProjectionMatrix = /*#__PURE__*/ uniform( 'mat4' ).onRenderUpdate( ( { camera } ) => camera.projectionMatrix );
|
|
8
|
+
export const cameraProjectionMatrixInverse = /*#__PURE__*/ uniform( 'mat4' ).onRenderUpdate( ( { camera } ) => camera.projectionMatrixInverse );
|
|
9
|
+
export const cameraViewMatrix = /*#__PURE__*/ uniform( 'mat4' ).onRenderUpdate( ( { camera } ) => camera.matrixWorldInverse );
|
|
10
|
+
export const cameraWorldMatrix = /*#__PURE__*/ uniform( 'mat4' ).onRenderUpdate( ( { camera } ) => camera.matrixWorld );
|
|
11
|
+
export const cameraNormalMatrix = /*#__PURE__*/ uniform( 'mat3' ).onRenderUpdate( ( { camera } ) => camera.normalMatrix );
|
|
12
|
+
export const cameraPosition = /*#__PURE__*/ uniform( new Vector3() ).onRenderUpdate( ( { camera }, self ) => self.value.setFromMatrixPosition( camera.matrixWorld ) );
|
|
@@ -5,7 +5,7 @@ import { positionView } from './PositionNode.js';
|
|
|
5
5
|
import { diffuseColor, property } from '../core/PropertyNode.js';
|
|
6
6
|
import { tslFn } from '../shadernode/ShaderNode.js';
|
|
7
7
|
import { loop } from '../utils/LoopNode.js';
|
|
8
|
-
import { smoothstep
|
|
8
|
+
import { smoothstep } from '../math/MathNode.js';
|
|
9
9
|
import { uniforms } from './UniformsNode.js';
|
|
10
10
|
|
|
11
11
|
class ClippingNode extends Node {
|
|
@@ -78,7 +78,7 @@ class ClippingNode extends Node {
|
|
|
78
78
|
|
|
79
79
|
plane = clippingPlanes.element( i );
|
|
80
80
|
|
|
81
|
-
distanceToPlane.assign( positionView.dot(
|
|
81
|
+
distanceToPlane.assign( positionView.dot( plane.xyz ).negate().add( plane.w ) );
|
|
82
82
|
distanceGradient.assign( distanceToPlane.fwidth().div( 2.0 ) );
|
|
83
83
|
|
|
84
84
|
unionClipOpacity.mulAssign( smoothstep( distanceGradient.negate(), distanceGradient, distanceToPlane ).oneMinus() );
|
|
@@ -126,6 +126,7 @@ class ClippingNode extends Node {
|
|
|
126
126
|
} );
|
|
127
127
|
|
|
128
128
|
clipped.discard();
|
|
129
|
+
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
} )();
|
|
@@ -2,7 +2,9 @@ import Node, { addNodeClass } from '../core/Node.js';
|
|
|
2
2
|
import { reference } from './ReferenceNode.js';
|
|
3
3
|
import { materialReference } from './MaterialReferenceNode.js';
|
|
4
4
|
import { normalView } from './NormalNode.js';
|
|
5
|
-
import { nodeImmutable, float } from '../shadernode/ShaderNode.js';
|
|
5
|
+
import { nodeImmutable, float, vec2, mat2 } from '../shadernode/ShaderNode.js';
|
|
6
|
+
import { uniform } from '../core/UniformNode.js';
|
|
7
|
+
import { Vector2 } from 'three';
|
|
6
8
|
|
|
7
9
|
const _propertyCache = new Map();
|
|
8
10
|
|
|
@@ -89,7 +91,7 @@ class MaterialNode extends Node {
|
|
|
89
91
|
|
|
90
92
|
if ( material.specularMap && material.specularMap.isTexture === true ) {
|
|
91
93
|
|
|
92
|
-
node = this.getTexture(
|
|
94
|
+
node = this.getTexture( 'specular' ).r;
|
|
93
95
|
|
|
94
96
|
} else {
|
|
95
97
|
|
|
@@ -97,6 +99,34 @@ class MaterialNode extends Node {
|
|
|
97
99
|
|
|
98
100
|
}
|
|
99
101
|
|
|
102
|
+
} else if ( scope === MaterialNode.SPECULAR_INTENSITY ) {
|
|
103
|
+
|
|
104
|
+
const specularIntensity = this.getFloat( scope );
|
|
105
|
+
|
|
106
|
+
if ( material.specularMap ) {
|
|
107
|
+
|
|
108
|
+
node = specularIntensity.mul( this.getTexture( scope ).a );
|
|
109
|
+
|
|
110
|
+
} else {
|
|
111
|
+
|
|
112
|
+
node = specularIntensity;
|
|
113
|
+
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
} else if ( scope === MaterialNode.SPECULAR_COLOR ) {
|
|
117
|
+
|
|
118
|
+
const specularColorNode = this.getColor( scope );
|
|
119
|
+
|
|
120
|
+
if ( material.specularColorMap && material.specularColorMap.isTexture === true ) {
|
|
121
|
+
|
|
122
|
+
node = specularColorNode.mul( this.getTexture( scope ).rgb );
|
|
123
|
+
|
|
124
|
+
} else {
|
|
125
|
+
|
|
126
|
+
node = specularColorNode;
|
|
127
|
+
|
|
128
|
+
}
|
|
129
|
+
|
|
100
130
|
} else if ( scope === MaterialNode.ROUGHNESS ) { // TODO: cleanup similar branches
|
|
101
131
|
|
|
102
132
|
const roughnessNode = this.getFloat( scope );
|
|
@@ -225,6 +255,21 @@ class MaterialNode extends Node {
|
|
|
225
255
|
|
|
226
256
|
node = node.clamp( 0.07, 1.0 );
|
|
227
257
|
|
|
258
|
+
} else if ( scope === MaterialNode.ANISOTROPY ) {
|
|
259
|
+
|
|
260
|
+
if ( material.anisotropyMap && material.anisotropyMap.isTexture === true ) {
|
|
261
|
+
|
|
262
|
+
const anisotropyPolar = this.getTexture( scope );
|
|
263
|
+
const anisotropyMat = mat2( materialAnisotropyVector.x, materialAnisotropyVector.y, materialAnisotropyVector.y.negate(), materialAnisotropyVector.x );
|
|
264
|
+
|
|
265
|
+
node = anisotropyMat.mul( anisotropyPolar.rg.mul( 2.0 ).sub( vec2( 1.0 ) ).normalize().mul( anisotropyPolar.b ) );
|
|
266
|
+
|
|
267
|
+
} else {
|
|
268
|
+
|
|
269
|
+
node = materialAnisotropyVector;
|
|
270
|
+
|
|
271
|
+
}
|
|
272
|
+
|
|
228
273
|
} else if ( scope === MaterialNode.IRIDESCENCE_THICKNESS ) {
|
|
229
274
|
|
|
230
275
|
const iridescenceThicknessMaximum = reference( '1', 'float', material.iridescenceThicknessRange );
|
|
@@ -241,6 +286,38 @@ class MaterialNode extends Node {
|
|
|
241
286
|
|
|
242
287
|
}
|
|
243
288
|
|
|
289
|
+
} else if ( scope === MaterialNode.TRANSMISSION ) {
|
|
290
|
+
|
|
291
|
+
const transmissionNode = this.getFloat( scope );
|
|
292
|
+
|
|
293
|
+
if ( material.transmissionMap ) {
|
|
294
|
+
|
|
295
|
+
node = transmissionNode.mul( this.getTexture( scope ).r );
|
|
296
|
+
|
|
297
|
+
} else {
|
|
298
|
+
|
|
299
|
+
node = transmissionNode;
|
|
300
|
+
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
} else if ( scope === MaterialNode.THICKNESS ) {
|
|
304
|
+
|
|
305
|
+
const thicknessNode = this.getFloat( scope );
|
|
306
|
+
|
|
307
|
+
if ( material.thicknessMap ) {
|
|
308
|
+
|
|
309
|
+
node = thicknessNode.mul( this.getTexture( scope ).g );
|
|
310
|
+
|
|
311
|
+
} else {
|
|
312
|
+
|
|
313
|
+
node = thicknessNode;
|
|
314
|
+
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
} else if ( scope === MaterialNode.IOR ) {
|
|
318
|
+
|
|
319
|
+
node = this.getFloat( scope );
|
|
320
|
+
|
|
244
321
|
} else {
|
|
245
322
|
|
|
246
323
|
const outputType = this.getNodeType( builder );
|
|
@@ -259,8 +336,10 @@ MaterialNode.ALPHA_TEST = 'alphaTest';
|
|
|
259
336
|
MaterialNode.COLOR = 'color';
|
|
260
337
|
MaterialNode.OPACITY = 'opacity';
|
|
261
338
|
MaterialNode.SHININESS = 'shininess';
|
|
262
|
-
MaterialNode.
|
|
339
|
+
MaterialNode.SPECULAR = 'specular';
|
|
263
340
|
MaterialNode.SPECULAR_STRENGTH = 'specularStrength';
|
|
341
|
+
MaterialNode.SPECULAR_INTENSITY = 'specularIntensity';
|
|
342
|
+
MaterialNode.SPECULAR_COLOR = 'specularColor';
|
|
264
343
|
MaterialNode.REFLECTIVITY = 'reflectivity';
|
|
265
344
|
MaterialNode.ROUGHNESS = 'roughness';
|
|
266
345
|
MaterialNode.METALNESS = 'metalness';
|
|
@@ -272,15 +351,22 @@ MaterialNode.EMISSIVE = 'emissive';
|
|
|
272
351
|
MaterialNode.ROTATION = 'rotation';
|
|
273
352
|
MaterialNode.SHEEN = 'sheen';
|
|
274
353
|
MaterialNode.SHEEN_ROUGHNESS = 'sheenRoughness';
|
|
354
|
+
MaterialNode.ANISOTROPY = 'anisotropy';
|
|
275
355
|
MaterialNode.IRIDESCENCE = 'iridescence';
|
|
276
356
|
MaterialNode.IRIDESCENCE_IOR = 'iridescenceIOR';
|
|
277
357
|
MaterialNode.IRIDESCENCE_THICKNESS = 'iridescenceThickness';
|
|
358
|
+
MaterialNode.IOR = 'ior';
|
|
359
|
+
MaterialNode.TRANSMISSION = 'transmission';
|
|
360
|
+
MaterialNode.THICKNESS = 'thickness';
|
|
361
|
+
MaterialNode.ATTENUATION_DISTANCE = 'attenuationDistance';
|
|
362
|
+
MaterialNode.ATTENUATION_COLOR = 'attenuationColor';
|
|
278
363
|
MaterialNode.LINE_SCALE = 'scale';
|
|
279
364
|
MaterialNode.LINE_DASH_SIZE = 'dashSize';
|
|
280
365
|
MaterialNode.LINE_GAP_SIZE = 'gapSize';
|
|
281
366
|
MaterialNode.LINE_WIDTH = 'linewidth';
|
|
282
367
|
MaterialNode.LINE_DASH_OFFSET = 'dashOffset';
|
|
283
368
|
MaterialNode.POINT_WIDTH = 'pointWidth';
|
|
369
|
+
MaterialNode.DISPERSION = 'dispersion';
|
|
284
370
|
|
|
285
371
|
export default MaterialNode;
|
|
286
372
|
|
|
@@ -289,7 +375,11 @@ export const materialColor = nodeImmutable( MaterialNode, MaterialNode.COLOR );
|
|
|
289
375
|
export const materialShininess = nodeImmutable( MaterialNode, MaterialNode.SHININESS );
|
|
290
376
|
export const materialEmissive = nodeImmutable( MaterialNode, MaterialNode.EMISSIVE );
|
|
291
377
|
export const materialOpacity = nodeImmutable( MaterialNode, MaterialNode.OPACITY );
|
|
378
|
+
export const materialSpecular = nodeImmutable( MaterialNode, MaterialNode.SPECULAR );
|
|
379
|
+
|
|
380
|
+
export const materialSpecularIntensity = nodeImmutable( MaterialNode, MaterialNode.SPECULAR_INTENSITY );
|
|
292
381
|
export const materialSpecularColor = nodeImmutable( MaterialNode, MaterialNode.SPECULAR_COLOR );
|
|
382
|
+
|
|
293
383
|
export const materialSpecularStrength = nodeImmutable( MaterialNode, MaterialNode.SPECULAR_STRENGTH );
|
|
294
384
|
export const materialReflectivity = nodeImmutable( MaterialNode, MaterialNode.REFLECTIVITY );
|
|
295
385
|
export const materialRoughness = nodeImmutable( MaterialNode, MaterialNode.ROUGHNESS );
|
|
@@ -301,14 +391,30 @@ export const materialClearcoatNormal = nodeImmutable( MaterialNode, MaterialNode
|
|
|
301
391
|
export const materialRotation = nodeImmutable( MaterialNode, MaterialNode.ROTATION );
|
|
302
392
|
export const materialSheen = nodeImmutable( MaterialNode, MaterialNode.SHEEN );
|
|
303
393
|
export const materialSheenRoughness = nodeImmutable( MaterialNode, MaterialNode.SHEEN_ROUGHNESS );
|
|
394
|
+
export const materialAnisotropy = nodeImmutable( MaterialNode, MaterialNode.ANISOTROPY );
|
|
304
395
|
export const materialIridescence = nodeImmutable( MaterialNode, MaterialNode.IRIDESCENCE );
|
|
305
396
|
export const materialIridescenceIOR = nodeImmutable( MaterialNode, MaterialNode.IRIDESCENCE_IOR );
|
|
306
397
|
export const materialIridescenceThickness = nodeImmutable( MaterialNode, MaterialNode.IRIDESCENCE_THICKNESS );
|
|
398
|
+
export const materialTransmission = nodeImmutable( MaterialNode, MaterialNode.TRANSMISSION );
|
|
399
|
+
export const materialThickness = nodeImmutable( MaterialNode, MaterialNode.THICKNESS );
|
|
400
|
+
export const materialIOR = nodeImmutable( MaterialNode, MaterialNode.IOR );
|
|
401
|
+
export const materialAttenuationDistance = nodeImmutable( MaterialNode, MaterialNode.ATTENUATION_DISTANCE );
|
|
402
|
+
export const materialAttenuationColor = nodeImmutable( MaterialNode, MaterialNode.ATTENUATION_COLOR );
|
|
307
403
|
export const materialLineScale = nodeImmutable( MaterialNode, MaterialNode.LINE_SCALE );
|
|
308
404
|
export const materialLineDashSize = nodeImmutable( MaterialNode, MaterialNode.LINE_DASH_SIZE );
|
|
309
405
|
export const materialLineGapSize = nodeImmutable( MaterialNode, MaterialNode.LINE_GAP_SIZE );
|
|
310
406
|
export const materialLineWidth = nodeImmutable( MaterialNode, MaterialNode.LINE_WIDTH );
|
|
311
407
|
export const materialLineDashOffset = nodeImmutable( MaterialNode, MaterialNode.LINE_DASH_OFFSET );
|
|
312
408
|
export const materialPointWidth = nodeImmutable( MaterialNode, MaterialNode.POINT_WIDTH );
|
|
409
|
+
export const materialDispersion = nodeImmutable( MaterialNode, MaterialNode.DISPERSION );
|
|
410
|
+
export const materialAnisotropyVector = uniform( new Vector2() ).onReference( function ( frame ) {
|
|
411
|
+
|
|
412
|
+
return frame.material;
|
|
413
|
+
|
|
414
|
+
} ).onRenderUpdate( function ( { material } ) {
|
|
415
|
+
|
|
416
|
+
this.value.set( material.anisotropy * Math.cos( material.anisotropyRotation ), material.anisotropy * Math.sin( material.anisotropyRotation ) );
|
|
417
|
+
|
|
418
|
+
} );
|
|
313
419
|
|
|
314
420
|
addNodeClass( 'MaterialNode', MaterialNode );
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import Object3DNode from './Object3DNode.js';
|
|
2
2
|
import { addNodeClass } from '../core/Node.js';
|
|
3
3
|
import { nodeImmutable } from '../shadernode/ShaderNode.js';
|
|
4
|
+
import { uniform } from '../core/UniformNode.js';
|
|
5
|
+
import { Matrix4 } from 'three';
|
|
4
6
|
|
|
5
7
|
class ModelNode extends Object3DNode {
|
|
6
8
|
|
|
@@ -29,5 +31,6 @@ export const modelWorldMatrix = nodeImmutable( ModelNode, ModelNode.WORLD_MATRIX
|
|
|
29
31
|
export const modelPosition = nodeImmutable( ModelNode, ModelNode.POSITION );
|
|
30
32
|
export const modelScale = nodeImmutable( ModelNode, ModelNode.SCALE );
|
|
31
33
|
export const modelViewPosition = nodeImmutable( ModelNode, ModelNode.VIEW_POSITION );
|
|
34
|
+
export const modelWorldMatrixInverse = uniform( new Matrix4() ).onObjectUpdate( ( { object }, self ) => self.value.copy( object.matrixWorld ).invert() );
|
|
32
35
|
|
|
33
36
|
addNodeClass( 'ModelNode', ModelNode );
|
|
@@ -1,106 +1,14 @@
|
|
|
1
|
-
import Node, { addNodeClass } from '../core/Node.js';
|
|
2
1
|
import { attribute } from '../core/AttributeNode.js';
|
|
3
2
|
import { varying } from '../core/VaryingNode.js';
|
|
4
3
|
import { property } from '../core/PropertyNode.js';
|
|
5
|
-
import { normalize } from '../math/MathNode.js';
|
|
6
4
|
import { cameraViewMatrix } from './CameraNode.js';
|
|
7
5
|
import { modelNormalMatrix } from './ModelNode.js';
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
isGlobal() {
|
|
21
|
-
|
|
22
|
-
return true;
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
getHash( /*builder*/ ) {
|
|
27
|
-
|
|
28
|
-
return `normal-${this.scope}`;
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
generate( builder ) {
|
|
33
|
-
|
|
34
|
-
const scope = this.scope;
|
|
35
|
-
|
|
36
|
-
let outputNode = null;
|
|
37
|
-
|
|
38
|
-
if ( scope === NormalNode.GEOMETRY ) {
|
|
39
|
-
|
|
40
|
-
const geometryAttribute = builder.hasGeometryAttribute( 'normal' );
|
|
41
|
-
|
|
42
|
-
if ( geometryAttribute === false ) {
|
|
43
|
-
|
|
44
|
-
outputNode = vec3( 0, 1, 0 );
|
|
45
|
-
|
|
46
|
-
} else {
|
|
47
|
-
|
|
48
|
-
outputNode = attribute( 'normal', 'vec3' );
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
} else if ( scope === NormalNode.LOCAL ) {
|
|
53
|
-
|
|
54
|
-
outputNode = varying( normalGeometry );
|
|
55
|
-
|
|
56
|
-
} else if ( scope === NormalNode.VIEW ) {
|
|
57
|
-
|
|
58
|
-
const vertexNode = modelNormalMatrix.mul( normalLocal );
|
|
59
|
-
outputNode = normalize( varying( vertexNode ) );
|
|
60
|
-
|
|
61
|
-
} else if ( scope === NormalNode.WORLD ) {
|
|
62
|
-
|
|
63
|
-
// To use inverseTransformDirection only inverse the param order like this: cameraViewMatrix.transformDirection( normalView )
|
|
64
|
-
const vertexNode = normalView.transformDirection( cameraViewMatrix );
|
|
65
|
-
outputNode = normalize( varying( vertexNode ) );
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return outputNode.build( builder, this.getNodeType( builder ) );
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
serialize( data ) {
|
|
74
|
-
|
|
75
|
-
super.serialize( data );
|
|
76
|
-
|
|
77
|
-
data.scope = this.scope;
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
deserialize( data ) {
|
|
82
|
-
|
|
83
|
-
super.deserialize( data );
|
|
84
|
-
|
|
85
|
-
this.scope = data.scope;
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
NormalNode.GEOMETRY = 'geometry';
|
|
92
|
-
NormalNode.LOCAL = 'local';
|
|
93
|
-
NormalNode.VIEW = 'view';
|
|
94
|
-
NormalNode.WORLD = 'world';
|
|
95
|
-
|
|
96
|
-
export default NormalNode;
|
|
97
|
-
|
|
98
|
-
export const normalGeometry = nodeImmutable( NormalNode, NormalNode.GEOMETRY );
|
|
99
|
-
export const normalLocal = nodeImmutable( NormalNode, NormalNode.LOCAL ).temp( 'Normal' );
|
|
100
|
-
export const normalView = nodeImmutable( NormalNode, NormalNode.VIEW );
|
|
101
|
-
export const normalWorld = nodeImmutable( NormalNode, NormalNode.WORLD );
|
|
102
|
-
export const transformedNormalView = property( 'vec3', 'TransformedNormalView' );
|
|
103
|
-
export const transformedNormalWorld = transformedNormalView.transformDirection( cameraViewMatrix ).normalize();
|
|
104
|
-
export const transformedClearcoatNormalView = property( 'vec3', 'TransformedClearcoatNormalView' );
|
|
105
|
-
|
|
106
|
-
addNodeClass( 'NormalNode', NormalNode );
|
|
6
|
+
import { vec3 } from '../shadernode/ShaderNode.js';
|
|
7
|
+
|
|
8
|
+
export const normalGeometry = /*#__PURE__*/ attribute( 'normal', 'vec3', vec3( 0, 1, 0 ) );
|
|
9
|
+
export const normalLocal = /*#__PURE__*/ normalGeometry.toVar( 'normalLocal' );
|
|
10
|
+
export const normalView = /*#__PURE__*/ varying( modelNormalMatrix.mul( normalLocal ), 'v_normalView' ).normalize().toVar( 'normalView' );
|
|
11
|
+
export const normalWorld = /*#__PURE__*/ varying( normalView.transformDirection( cameraViewMatrix ), 'v_normalWorld' ).normalize().toVar( 'transformedNormalWorld' );
|
|
12
|
+
export const transformedNormalView = /*#__PURE__*/ property( 'vec3', 'transformedNormalView' );
|
|
13
|
+
export const transformedNormalWorld = /*#__PURE__*/ transformedNormalView.transformDirection( cameraViewMatrix ).normalize().toVar( 'transformedNormalWorld' );
|
|
14
|
+
export const transformedClearcoatNormalView = /*#__PURE__*/ property( 'vec3', 'transformedClearcoatNormalView' );
|