super-three 0.177.0 → 0.179.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 +1 -1
- package/build/three.cjs +959 -231
- package/build/three.core.js +751 -170
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +210 -64
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +78 -29
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +3269 -1545
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +3093 -1545
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +1 -2
- package/examples/jsm/capabilities/WebGL.js +0 -27
- package/examples/jsm/capabilities/WebGPU.js +1 -1
- package/examples/jsm/controls/ArcballControls.js +1 -1
- package/examples/jsm/controls/TransformControls.js +61 -14
- package/examples/jsm/csm/CSMShadowNode.js +4 -4
- package/examples/jsm/environments/RoomEnvironment.js +8 -3
- package/examples/jsm/exporters/USDZExporter.js +676 -299
- package/examples/jsm/geometries/RoundedBoxGeometry.js +47 -8
- package/examples/jsm/interactive/HTMLMesh.js +5 -3
- package/examples/jsm/libs/meshopt_decoder.module.js +75 -58
- package/examples/jsm/lights/LightProbeGenerator.js +14 -3
- package/examples/jsm/loaders/ColladaLoader.js +1 -1
- package/examples/jsm/loaders/EXRLoader.js +210 -22
- package/examples/jsm/loaders/FBXLoader.js +2 -2
- package/examples/jsm/loaders/MaterialXLoader.js +212 -30
- package/examples/jsm/loaders/TTFLoader.js +13 -1
- package/examples/jsm/loaders/USDLoader.js +219 -0
- package/examples/jsm/loaders/USDZLoader.js +4 -892
- package/examples/jsm/loaders/usd/USDAParser.js +741 -0
- package/examples/jsm/loaders/usd/USDCParser.js +17 -0
- package/examples/jsm/objects/LensflareMesh.js +3 -3
- package/examples/jsm/objects/SkyMesh.js +2 -2
- package/examples/jsm/physics/RapierPhysics.js +95 -16
- package/examples/jsm/postprocessing/GTAOPass.js +10 -9
- package/examples/jsm/postprocessing/OutlinePass.js +17 -17
- package/examples/jsm/postprocessing/SSAOPass.js +10 -9
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +11 -2
- package/examples/jsm/transpiler/AST.js +381 -30
- package/examples/jsm/transpiler/GLSLDecoder.js +226 -86
- package/examples/jsm/transpiler/Linker.js +327 -0
- package/examples/jsm/transpiler/TSLEncoder.js +197 -92
- package/examples/jsm/transpiler/Transpiler.js +17 -1
- package/examples/jsm/transpiler/TranspilerUtils.js +29 -0
- package/examples/jsm/transpiler/WGSLEncoder.js +788 -0
- package/examples/jsm/tsl/display/BloomNode.js +8 -7
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +206 -0
- package/examples/jsm/tsl/display/GaussianBlurNode.js +8 -10
- package/examples/jsm/tsl/display/SSAAPassNode.js +2 -2
- package/examples/jsm/tsl/display/{TRAAPassNode.js → TRAANode.js} +181 -172
- package/examples/jsm/tsl/display/hashBlur.js +3 -3
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +1 -1
- package/package.json +1 -1
- package/src/Three.Core.js +1 -0
- package/src/Three.TSL.js +77 -28
- package/src/Three.WebGPU.js +2 -0
- package/src/animation/KeyframeTrack.js +1 -1
- package/src/animation/tracks/BooleanKeyframeTrack.js +1 -1
- package/src/animation/tracks/StringKeyframeTrack.js +1 -1
- package/src/cameras/Camera.js +14 -0
- package/src/cameras/OrthographicCamera.js +1 -1
- package/src/cameras/PerspectiveCamera.js +1 -1
- package/src/constants.js +3 -3
- package/src/core/BufferAttribute.js +3 -3
- package/src/core/Clock.js +2 -8
- package/src/core/GLBufferAttribute.js +13 -1
- package/src/core/Object3D.js +1 -1
- package/{examples/jsm/misc → src/core}/Timer.js +4 -42
- package/src/extras/PMREMGenerator.js +11 -0
- package/src/extras/core/Path.js +22 -22
- package/src/helpers/CameraHelper.js +41 -11
- package/src/helpers/SkeletonHelper.js +35 -6
- package/src/lights/LightShadow.js +21 -8
- package/src/lights/PointLightShadow.js +1 -1
- package/src/loaders/FileLoader.js +27 -4
- package/src/loaders/ImageBitmapLoader.js +27 -4
- package/src/loaders/ImageLoader.js +55 -8
- package/src/loaders/Loader.js +14 -0
- package/src/loaders/LoadingManager.js +23 -0
- package/src/materials/MeshBasicMaterial.js +1 -1
- package/src/materials/nodes/Line2NodeMaterial.js +0 -8
- package/src/materials/nodes/MeshBasicNodeMaterial.js +4 -3
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +1 -1
- package/src/materials/nodes/MeshNormalNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +2 -1
- package/src/materials/nodes/MeshSSSNodeMaterial.js +2 -2
- package/src/materials/nodes/NodeMaterial.js +28 -5
- package/src/materials/nodes/PointsNodeMaterial.js +5 -0
- package/src/materials/nodes/manager/NodeMaterialObserver.js +87 -2
- package/src/math/Frustum.js +25 -9
- package/src/math/FrustumArray.js +10 -5
- package/src/math/Line3.js +129 -2
- package/src/math/Matrix4.js +48 -27
- package/src/math/Quaternion.js +1 -1
- package/src/math/Spherical.js +2 -2
- package/src/nodes/Nodes.js +2 -3
- package/src/nodes/TSL.js +5 -3
- package/src/nodes/accessors/AccessorsUtils.js +7 -8
- package/src/nodes/accessors/Bitangent.js +31 -25
- package/src/nodes/accessors/Camera.js +12 -12
- package/src/nodes/accessors/Normal.js +95 -29
- package/src/nodes/accessors/Object3DNode.js +1 -1
- package/src/nodes/accessors/Position.js +7 -7
- package/src/nodes/accessors/ReferenceNode.js +18 -3
- package/src/nodes/accessors/ReflectVector.js +3 -3
- package/src/nodes/accessors/SceneNode.js +1 -1
- package/src/nodes/accessors/StorageTextureNode.js +1 -1
- package/src/nodes/accessors/Tangent.js +25 -17
- package/src/nodes/accessors/TangentUtils.js +46 -0
- package/src/nodes/accessors/TextureBicubic.js +21 -3
- package/src/nodes/accessors/TextureNode.js +12 -0
- package/src/nodes/accessors/UniformArrayNode.js +0 -16
- package/src/nodes/core/ArrayNode.js +12 -0
- package/src/nodes/core/AssignNode.js +3 -0
- package/src/nodes/core/CacheNode.js +0 -14
- package/src/nodes/core/ContextNode.js +20 -1
- package/src/nodes/core/Node.js +15 -3
- package/src/nodes/core/NodeBuilder.js +228 -92
- package/src/nodes/core/NodeUtils.js +4 -1
- package/src/nodes/core/StackNode.js +49 -29
- package/src/nodes/core/SubBuildNode.js +89 -0
- package/src/nodes/core/UniformNode.js +63 -5
- package/src/nodes/core/VarNode.js +91 -2
- package/src/nodes/core/VaryingNode.js +6 -4
- package/src/nodes/display/BlendModes.js +2 -2
- package/src/nodes/display/FrontFacingNode.js +34 -2
- package/src/nodes/display/NormalMapNode.js +19 -50
- package/src/nodes/display/PassNode.js +157 -9
- package/src/nodes/display/ScreenNode.js +0 -26
- package/src/nodes/display/ViewportTextureNode.js +67 -7
- package/src/nodes/functions/BSDF/BRDF_GGX.js +2 -6
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +4 -4
- package/src/nodes/functions/PhongLightingModel.js +3 -3
- package/src/nodes/functions/PhysicalLightingModel.js +16 -16
- package/src/nodes/functions/material/getGeometryRoughness.js +2 -2
- package/src/nodes/gpgpu/AtomicFunctionNode.js +1 -1
- package/src/nodes/gpgpu/ComputeNode.js +67 -23
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +28 -3
- package/src/nodes/lighting/EnvironmentNode.js +5 -5
- package/src/nodes/lighting/LightsNode.js +4 -4
- package/src/nodes/lighting/ProjectorLightNode.js +19 -6
- package/src/nodes/lighting/ShadowFilterNode.js +1 -1
- package/src/nodes/lighting/ShadowNode.js +2 -2
- package/src/nodes/materialx/MaterialXNodes.js +131 -2
- package/src/nodes/materialx/lib/mx_noise.js +165 -1
- package/src/nodes/math/ConditionalNode.js +1 -20
- package/src/nodes/math/MathNode.js +90 -55
- package/src/nodes/math/OperatorNode.js +22 -39
- package/src/nodes/tsl/TSLBase.js +1 -0
- package/src/nodes/tsl/TSLCore.js +114 -55
- package/src/nodes/utils/DebugNode.js +1 -1
- package/src/nodes/utils/EquirectUV.js +27 -0
- package/src/nodes/utils/EventNode.js +83 -0
- package/src/nodes/utils/LoopNode.js +0 -17
- package/src/nodes/utils/MatcapUV.js +22 -0
- package/src/nodes/utils/RTTNode.js +22 -5
- package/src/nodes/utils/ReflectorNode.js +11 -4
- package/src/nodes/utils/SampleNode.js +81 -0
- package/src/nodes/utils/TriplanarTextures.js +65 -0
- package/src/objects/BatchedMesh.js +4 -2
- package/src/renderers/WebGLRenderer.js +26 -24
- package/src/renderers/common/Background.js +2 -2
- package/src/renderers/common/Bindings.js +19 -18
- package/src/renderers/common/Color4.js +2 -2
- package/src/renderers/common/CubeRenderTarget.js +1 -1
- package/src/renderers/common/PostProcessing.js +60 -5
- package/src/renderers/common/RenderObject.js +68 -3
- package/src/renderers/common/Renderer.js +19 -16
- package/src/renderers/common/SampledTexture.js +3 -71
- package/src/renderers/common/Sampler.js +79 -0
- package/src/renderers/common/Storage3DTexture.js +100 -0
- package/src/renderers/common/StorageArrayTexture.js +84 -0
- package/src/renderers/common/StorageTexture.js +19 -0
- package/src/renderers/common/Textures.js +19 -3
- package/src/renderers/common/XRManager.js +31 -12
- package/src/renderers/common/XRRenderTarget.js +21 -4
- package/src/renderers/common/extras/PMREMGenerator.js +1 -1
- package/src/renderers/common/nodes/NodeSampledTexture.js +0 -12
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +20 -2
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +11 -2
- package/src/renderers/webgl/WebGLAttributes.js +4 -0
- package/src/renderers/webgl/WebGLCapabilities.js +2 -2
- package/src/renderers/webgl/WebGLProgram.js +12 -6
- package/src/renderers/webgl/WebGLPrograms.js +6 -4
- package/src/renderers/webgl/WebGLShadowMap.js +11 -1
- package/src/renderers/webgl/WebGLState.js +4 -4
- package/src/renderers/webgl/WebGLTextures.js +19 -7
- package/src/renderers/webgl-fallback/WebGLBackend.js +103 -72
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +3 -5
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +4 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +4 -4
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +2 -0
- package/src/renderers/webgpu/WebGPUBackend.js +63 -16
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +64 -79
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +6 -0
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +45 -31
- package/src/renderers/webgpu/utils/WebGPUConstants.js +7 -1
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +5 -5
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +12 -65
- package/src/renderers/webgpu/utils/WebGPUUtils.js +2 -17
- package/src/renderers/webxr/WebXRDepthSensing.js +6 -10
- package/src/renderers/webxr/WebXRManager.js +68 -6
- package/src/textures/ExternalTexture.js +45 -0
- package/src/textures/FramebufferTexture.js +2 -2
- package/src/textures/Source.js +11 -1
- package/src/textures/VideoTexture.js +30 -2
- package/src/nodes/utils/EquirectUVNode.js +0 -65
- package/src/nodes/utils/MatcapUVNode.js +0 -49
- package/src/nodes/utils/TriplanarTexturesNode.js +0 -148
package/src/math/Matrix4.js
CHANGED
|
@@ -1103,11 +1103,13 @@ class Matrix4 {
|
|
|
1103
1103
|
* @param {number} near - The distance from the camera to the near plane.
|
|
1104
1104
|
* @param {number} far - The distance from the camera to the far plane.
|
|
1105
1105
|
* @param {(WebGLCoordinateSystem|WebGPUCoordinateSystem)} [coordinateSystem=WebGLCoordinateSystem] - The coordinate system.
|
|
1106
|
+
* @param {boolean} [reversedDepth=false] - Whether to use a reversed depth.
|
|
1106
1107
|
* @return {Matrix4} A reference to this matrix.
|
|
1107
1108
|
*/
|
|
1108
|
-
makePerspective( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {
|
|
1109
|
+
makePerspective( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem, reversedDepth = false ) {
|
|
1109
1110
|
|
|
1110
1111
|
const te = this.elements;
|
|
1112
|
+
|
|
1111
1113
|
const x = 2 * near / ( right - left );
|
|
1112
1114
|
const y = 2 * near / ( top - bottom );
|
|
1113
1115
|
|
|
@@ -1116,19 +1118,28 @@ class Matrix4 {
|
|
|
1116
1118
|
|
|
1117
1119
|
let c, d;
|
|
1118
1120
|
|
|
1119
|
-
if (
|
|
1121
|
+
if ( reversedDepth ) {
|
|
1120
1122
|
|
|
1121
|
-
c =
|
|
1122
|
-
d = (
|
|
1123
|
+
c = near / ( far - near );
|
|
1124
|
+
d = ( far * near ) / ( far - near );
|
|
1123
1125
|
|
|
1124
|
-
} else
|
|
1126
|
+
} else {
|
|
1125
1127
|
|
|
1126
|
-
|
|
1127
|
-
d = ( - far * near ) / ( far - near );
|
|
1128
|
+
if ( coordinateSystem === WebGLCoordinateSystem ) {
|
|
1128
1129
|
|
|
1129
|
-
|
|
1130
|
+
c = - ( far + near ) / ( far - near );
|
|
1131
|
+
d = ( - 2 * far * near ) / ( far - near );
|
|
1132
|
+
|
|
1133
|
+
} else if ( coordinateSystem === WebGPUCoordinateSystem ) {
|
|
1134
|
+
|
|
1135
|
+
c = - far / ( far - near );
|
|
1136
|
+
d = ( - far * near ) / ( far - near );
|
|
1130
1137
|
|
|
1131
|
-
|
|
1138
|
+
} else {
|
|
1139
|
+
|
|
1140
|
+
throw new Error( 'THREE.Matrix4.makePerspective(): Invalid coordinate system: ' + coordinateSystem );
|
|
1141
|
+
|
|
1142
|
+
}
|
|
1132
1143
|
|
|
1133
1144
|
}
|
|
1134
1145
|
|
|
@@ -1152,39 +1163,49 @@ class Matrix4 {
|
|
|
1152
1163
|
* @param {number} near - The distance from the camera to the near plane.
|
|
1153
1164
|
* @param {number} far - The distance from the camera to the far plane.
|
|
1154
1165
|
* @param {(WebGLCoordinateSystem|WebGPUCoordinateSystem)} [coordinateSystem=WebGLCoordinateSystem] - The coordinate system.
|
|
1166
|
+
* @param {boolean} [reversedDepth=false] - Whether to use a reversed depth.
|
|
1155
1167
|
* @return {Matrix4} A reference to this matrix.
|
|
1156
1168
|
*/
|
|
1157
|
-
makeOrthographic( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {
|
|
1169
|
+
makeOrthographic( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem, reversedDepth = false ) {
|
|
1158
1170
|
|
|
1159
1171
|
const te = this.elements;
|
|
1160
|
-
const w = 1.0 / ( right - left );
|
|
1161
|
-
const h = 1.0 / ( top - bottom );
|
|
1162
|
-
const p = 1.0 / ( far - near );
|
|
1163
|
-
|
|
1164
|
-
const x = ( right + left ) * w;
|
|
1165
|
-
const y = ( top + bottom ) * h;
|
|
1166
1172
|
|
|
1167
|
-
|
|
1173
|
+
const x = 2 / ( right - left );
|
|
1174
|
+
const y = 2 / ( top - bottom );
|
|
1168
1175
|
|
|
1169
|
-
|
|
1176
|
+
const a = - ( right + left ) / ( right - left );
|
|
1177
|
+
const b = - ( top + bottom ) / ( top - bottom );
|
|
1170
1178
|
|
|
1171
|
-
|
|
1172
|
-
zInv = - 2 * p;
|
|
1179
|
+
let c, d;
|
|
1173
1180
|
|
|
1174
|
-
|
|
1181
|
+
if ( reversedDepth ) {
|
|
1175
1182
|
|
|
1176
|
-
|
|
1177
|
-
|
|
1183
|
+
c = 1 / ( far - near );
|
|
1184
|
+
d = far / ( far - near );
|
|
1178
1185
|
|
|
1179
1186
|
} else {
|
|
1180
1187
|
|
|
1181
|
-
|
|
1188
|
+
if ( coordinateSystem === WebGLCoordinateSystem ) {
|
|
1189
|
+
|
|
1190
|
+
c = - 2 / ( far - near );
|
|
1191
|
+
d = - ( far + near ) / ( far - near );
|
|
1192
|
+
|
|
1193
|
+
} else if ( coordinateSystem === WebGPUCoordinateSystem ) {
|
|
1194
|
+
|
|
1195
|
+
c = - 1 / ( far - near );
|
|
1196
|
+
d = - near / ( far - near );
|
|
1197
|
+
|
|
1198
|
+
} else {
|
|
1199
|
+
|
|
1200
|
+
throw new Error( 'THREE.Matrix4.makeOrthographic(): Invalid coordinate system: ' + coordinateSystem );
|
|
1201
|
+
|
|
1202
|
+
}
|
|
1182
1203
|
|
|
1183
1204
|
}
|
|
1184
1205
|
|
|
1185
|
-
te[ 0 ] =
|
|
1186
|
-
te[ 1 ] = 0; te[ 5 ] =
|
|
1187
|
-
te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] =
|
|
1206
|
+
te[ 0 ] = x; te[ 4 ] = 0; te[ 8 ] = 0; te[ 12 ] = a;
|
|
1207
|
+
te[ 1 ] = 0; te[ 5 ] = y; te[ 9 ] = 0; te[ 13 ] = b;
|
|
1208
|
+
te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = c; te[ 14 ] = d;
|
|
1188
1209
|
te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = 0; te[ 15 ] = 1;
|
|
1189
1210
|
|
|
1190
1211
|
return this;
|
package/src/math/Quaternion.js
CHANGED
package/src/math/Spherical.js
CHANGED
|
@@ -107,8 +107,8 @@ class Spherical {
|
|
|
107
107
|
* Sets the spherical components from the given Cartesian coordinates.
|
|
108
108
|
*
|
|
109
109
|
* @param {number} x - The x value.
|
|
110
|
-
* @param {number} y - The
|
|
111
|
-
* @param {number} z - The
|
|
110
|
+
* @param {number} y - The y value.
|
|
111
|
+
* @param {number} z - The z value.
|
|
112
112
|
* @return {Spherical} A reference to this spherical.
|
|
113
113
|
*/
|
|
114
114
|
setFromCartesianCoords( x, y, z ) {
|
package/src/nodes/Nodes.js
CHANGED
|
@@ -33,6 +33,7 @@ export { default as StructNode } from './core/StructNode.js';
|
|
|
33
33
|
export { default as StructTypeNode } from './core/StructTypeNode.js';
|
|
34
34
|
export { default as OutputStructNode } from './core/OutputStructNode.js';
|
|
35
35
|
export { default as MRTNode } from './core/MRTNode.js';
|
|
36
|
+
export { default as SubBuildNode } from './core/SubBuildNode.js';
|
|
36
37
|
|
|
37
38
|
import * as NodeUtils from './core/NodeUtils.js';
|
|
38
39
|
export { NodeUtils };
|
|
@@ -40,11 +41,9 @@ export { NodeUtils };
|
|
|
40
41
|
// utils
|
|
41
42
|
export { default as ArrayElementNode } from './utils/ArrayElementNode.js';
|
|
42
43
|
export { default as ConvertNode } from './utils/ConvertNode.js';
|
|
43
|
-
export { default as EquirectUVNode } from './utils/EquirectUVNode.js';
|
|
44
44
|
export { default as FunctionOverloadingNode } from './utils/FunctionOverloadingNode.js';
|
|
45
45
|
export { default as JoinNode } from './utils/JoinNode.js';
|
|
46
46
|
export { default as LoopNode } from './utils/LoopNode.js';
|
|
47
|
-
export { default as MatcapUVNode } from './utils/MatcapUVNode.js';
|
|
48
47
|
export { default as MaxMipLevelNode } from './utils/MaxMipLevelNode.js';
|
|
49
48
|
export { default as RemapNode } from './utils/RemapNode.js';
|
|
50
49
|
export { default as RotateNode } from './utils/RotateNode.js';
|
|
@@ -52,11 +51,11 @@ export { default as SetNode } from './utils/SetNode.js';
|
|
|
52
51
|
export { default as SplitNode } from './utils/SplitNode.js';
|
|
53
52
|
export { default as SpriteSheetUVNode } from './utils/SpriteSheetUVNode.js';
|
|
54
53
|
export { default as StorageArrayElementNode } from './utils/StorageArrayElementNode.js';
|
|
55
|
-
export { default as TriplanarTexturesNode } from './utils/TriplanarTexturesNode.js';
|
|
56
54
|
export { default as ReflectorNode } from './utils/ReflectorNode.js';
|
|
57
55
|
export { default as RTTNode } from './utils/RTTNode.js';
|
|
58
56
|
export { default as MemberNode } from './utils/MemberNode.js';
|
|
59
57
|
export { default as DebugNode } from './utils/DebugNode.js';
|
|
58
|
+
export { default as EventNode } from './utils/EventNode.js';
|
|
60
59
|
|
|
61
60
|
// accessors
|
|
62
61
|
export { default as UniformArrayNode } from './accessors/UniformArrayNode.js';
|
package/src/nodes/TSL.js
CHANGED
|
@@ -24,10 +24,10 @@ export * from './math/MathUtils.js';
|
|
|
24
24
|
export * from './math/TriNoise3D.js';
|
|
25
25
|
|
|
26
26
|
// utils
|
|
27
|
-
export * from './utils/
|
|
27
|
+
export * from './utils/EquirectUV.js';
|
|
28
28
|
export * from './utils/FunctionOverloadingNode.js';
|
|
29
29
|
export * from './utils/LoopNode.js';
|
|
30
|
-
export * from './utils/
|
|
30
|
+
export * from './utils/MatcapUV.js';
|
|
31
31
|
export * from './utils/MaxMipLevelNode.js';
|
|
32
32
|
export * from './utils/Oscillators.js';
|
|
33
33
|
export * from './utils/Packing.js';
|
|
@@ -38,10 +38,12 @@ export * from './utils/ViewportUtils.js';
|
|
|
38
38
|
export * from './utils/RotateNode.js';
|
|
39
39
|
export * from './utils/SpriteSheetUVNode.js';
|
|
40
40
|
export * from './utils/Timer.js';
|
|
41
|
-
export * from './utils/
|
|
41
|
+
export * from './utils/TriplanarTextures.js';
|
|
42
42
|
export * from './utils/ReflectorNode.js';
|
|
43
43
|
export * from './utils/RTTNode.js';
|
|
44
44
|
export * from './utils/PostProcessingUtils.js';
|
|
45
|
+
export * from './utils/SampleNode.js';
|
|
46
|
+
export * from './utils/EventNode.js';
|
|
45
47
|
|
|
46
48
|
// three.js shading language
|
|
47
49
|
export * from './tsl/TSLBase.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { normalView, transformedNormalView } from './Normal.js';
|
|
1
|
+
import { normalView } from './Normal.js';
|
|
3
2
|
import { tangentView } from './Tangent.js';
|
|
4
|
-
import {
|
|
3
|
+
import { bitangentView } from './Bitangent.js';
|
|
4
|
+
import { Fn, mat3 } from '../tsl/TSLBase.js';
|
|
5
5
|
import { mix } from '../math/MathNode.js';
|
|
6
6
|
import { anisotropy, anisotropyB, roughness } from '../core/PropertyNode.js';
|
|
7
7
|
import { positionViewDirection } from './Position.js';
|
|
@@ -12,7 +12,7 @@ import { positionViewDirection } from './Position.js';
|
|
|
12
12
|
* @tsl
|
|
13
13
|
* @type {Node<mat3>}
|
|
14
14
|
*/
|
|
15
|
-
export const TBNViewMatrix = /*@__PURE__*/ mat3( tangentView, bitangentView, normalView );
|
|
15
|
+
export const TBNViewMatrix = /*@__PURE__*/ mat3( tangentView, bitangentView, normalView ).toVar( 'TBNViewMatrix' );
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* TSL object that represents the parallax direction.
|
|
@@ -40,15 +40,14 @@ export const parallaxUV = ( uv, scale ) => uv.sub( parallaxDirection.mul( scale
|
|
|
40
40
|
* @function
|
|
41
41
|
* @returns {Node<vec3>} Bent normals.
|
|
42
42
|
*/
|
|
43
|
-
export const
|
|
43
|
+
export const bentNormalView = /*@__PURE__*/ ( Fn( () => {
|
|
44
44
|
|
|
45
45
|
// https://google.github.io/filament/Filament.md.html#lighting/imagebasedlights/anisotropy
|
|
46
46
|
|
|
47
47
|
let bentNormal = anisotropyB.cross( positionViewDirection );
|
|
48
48
|
bentNormal = bentNormal.cross( anisotropyB ).normalize();
|
|
49
|
-
bentNormal = mix( bentNormal,
|
|
49
|
+
bentNormal = mix( bentNormal, normalView, anisotropy.mul( roughness.oneMinus() ).oneMinus().pow2().pow2() ).normalize();
|
|
50
50
|
|
|
51
51
|
return bentNormal;
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
} )();
|
|
53
|
+
} ).once() )();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { varying } from '../core/VaryingNode.js';
|
|
2
1
|
import { Fn } from '../tsl/TSLCore.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { normalGeometry, normalLocal, normalView, normalWorld } from './Normal.js';
|
|
3
|
+
import { tangentGeometry, tangentLocal, tangentView, tangentWorld } from './Tangent.js';
|
|
4
|
+
import { bitangentViewFrame } from './TangentUtils.js';
|
|
5
|
+
import { directionToFaceDirection } from '../display/FrontFacingNode.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Returns the bitangent node and assigns it to a varying if the material is not flat shaded.
|
|
@@ -13,19 +13,19 @@ import { tangentGeometry, tangentLocal, tangentView, tangentWorld, transformedTa
|
|
|
13
13
|
* @param {string} varyingName - The name of the varying to assign the bitangent to.
|
|
14
14
|
* @returns {Node<vec3>} The bitangent node.
|
|
15
15
|
*/
|
|
16
|
-
const getBitangent = /*@__PURE__*/ Fn( ( [ crossNormalTangent, varyingName ],
|
|
16
|
+
const getBitangent = /*@__PURE__*/ Fn( ( [ crossNormalTangent, varyingName ], { subBuildFn, material } ) => {
|
|
17
17
|
|
|
18
18
|
let bitangent = crossNormalTangent.mul( tangentGeometry.w ).xyz;
|
|
19
19
|
|
|
20
|
-
if (
|
|
20
|
+
if ( subBuildFn === 'NORMAL' && material.flatShading !== true ) {
|
|
21
21
|
|
|
22
|
-
bitangent =
|
|
22
|
+
bitangent = bitangent.toVarying( varyingName );
|
|
23
23
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
return bitangent;
|
|
27
27
|
|
|
28
|
-
} ).once();
|
|
28
|
+
} ).once( [ 'NORMAL' ] );
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* TSL object that represents the bitangent attribute of the current rendered object.
|
|
@@ -49,7 +49,29 @@ export const bitangentLocal = /*@__PURE__*/ getBitangent( normalLocal.cross( tan
|
|
|
49
49
|
* @tsl
|
|
50
50
|
* @type {Node<vec3>}
|
|
51
51
|
*/
|
|
52
|
-
export const bitangentView =
|
|
52
|
+
export const bitangentView = /*@__PURE__*/ ( Fn( ( { subBuildFn, geometry, material } ) => {
|
|
53
|
+
|
|
54
|
+
let node;
|
|
55
|
+
|
|
56
|
+
if ( subBuildFn === 'VERTEX' || geometry.hasAttribute( 'tangent' ) ) {
|
|
57
|
+
|
|
58
|
+
node = getBitangent( normalView.cross( tangentView ), 'v_bitangentView' ).normalize();
|
|
59
|
+
|
|
60
|
+
} else {
|
|
61
|
+
|
|
62
|
+
node = bitangentViewFrame;
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if ( material.flatShading !== true ) {
|
|
67
|
+
|
|
68
|
+
node = directionToFaceDirection( node );
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return node;
|
|
73
|
+
|
|
74
|
+
}, 'vec3' ).once( [ 'NORMAL', 'VERTEX' ] ) )().toVar( 'bitangentView' );
|
|
53
75
|
|
|
54
76
|
/**
|
|
55
77
|
* TSL object that represents the vertex bitangent in world space of the current rendered object.
|
|
@@ -58,19 +80,3 @@ export const bitangentView = getBitangent( normalView.cross( tangentView ), 'v_b
|
|
|
58
80
|
* @type {Node<vec3>}
|
|
59
81
|
*/
|
|
60
82
|
export const bitangentWorld = /*@__PURE__*/ getBitangent( normalWorld.cross( tangentWorld ), 'v_bitangentWorld' ).normalize().toVar( 'bitangentWorld' );
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* TSL object that represents the transformed vertex bitangent in view space of the current rendered object.
|
|
64
|
-
*
|
|
65
|
-
* @tsl
|
|
66
|
-
* @type {Node<vec3>}
|
|
67
|
-
*/
|
|
68
|
-
export const transformedBitangentView = /*@__PURE__*/ getBitangent( transformedNormalView.cross( transformedTangentView ), 'v_transformedBitangentView' ).normalize().toVar( 'transformedBitangentView' );
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* TSL object that represents the transformed vertex bitangent in world space of the current rendered object.
|
|
72
|
-
*
|
|
73
|
-
* @tsl
|
|
74
|
-
* @type {Node<vec4>}
|
|
75
|
-
*/
|
|
76
|
-
export const transformedBitangentWorld = /*@__PURE__*/ transformedBitangentView.transformDirection( cameraViewMatrix ).normalize().toVar( 'transformedBitangentWorld' );
|
|
@@ -11,7 +11,7 @@ import { builtin } from './BuiltinNode.js';
|
|
|
11
11
|
* @tsl
|
|
12
12
|
* @type {UniformNode<uint>}
|
|
13
13
|
*/
|
|
14
|
-
export const cameraIndex = /*@__PURE__*/ uniform( 0, 'uint' ).
|
|
14
|
+
export const cameraIndex = /*@__PURE__*/ uniform( 0, 'uint' ).setName( 'u_cameraIndex' ).setGroup( sharedUniformGroup( 'cameraIndex' ) ).toVarying( 'v_cameraIndex' );
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* TSL object that represents the `near` value of the camera used for the current render.
|
|
@@ -19,7 +19,7 @@ export const cameraIndex = /*@__PURE__*/ uniform( 0, 'uint' ).label( 'u_cameraIn
|
|
|
19
19
|
* @tsl
|
|
20
20
|
* @type {UniformNode<float>}
|
|
21
21
|
*/
|
|
22
|
-
export const cameraNear = /*@__PURE__*/ uniform( 'float' ).
|
|
22
|
+
export const cameraNear = /*@__PURE__*/ uniform( 'float' ).setName( 'cameraNear' ).setGroup( renderGroup ).onRenderUpdate( ( { camera } ) => camera.near );
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* TSL object that represents the `far` value of the camera used for the current render.
|
|
@@ -27,7 +27,7 @@ export const cameraNear = /*@__PURE__*/ uniform( 'float' ).label( 'cameraNear' )
|
|
|
27
27
|
* @tsl
|
|
28
28
|
* @type {UniformNode<float>}
|
|
29
29
|
*/
|
|
30
|
-
export const cameraFar = /*@__PURE__*/ uniform( 'float' ).
|
|
30
|
+
export const cameraFar = /*@__PURE__*/ uniform( 'float' ).setName( 'cameraFar' ).setGroup( renderGroup ).onRenderUpdate( ( { camera } ) => camera.far );
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* TSL object that represents the projection matrix of the camera used for the current render.
|
|
@@ -49,13 +49,13 @@ export const cameraProjectionMatrix = /*@__PURE__*/ ( Fn( ( { camera } ) => {
|
|
|
49
49
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
const cameraProjectionMatrices = uniformArray( matrices ).setGroup( renderGroup ).
|
|
52
|
+
const cameraProjectionMatrices = uniformArray( matrices ).setGroup( renderGroup ).setName( 'cameraProjectionMatrices' );
|
|
53
53
|
|
|
54
54
|
cameraProjectionMatrix = cameraProjectionMatrices.element( camera.isMultiViewCamera ? builtin( 'gl_ViewID_OVR' ) : cameraIndex ).toVar( 'cameraProjectionMatrix' );
|
|
55
55
|
|
|
56
56
|
} else {
|
|
57
57
|
|
|
58
|
-
cameraProjectionMatrix = uniform( 'mat4' ).
|
|
58
|
+
cameraProjectionMatrix = uniform( 'mat4' ).setName( 'cameraProjectionMatrix' ).setGroup( renderGroup ).onRenderUpdate( ( { camera } ) => camera.projectionMatrix );
|
|
59
59
|
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -83,13 +83,13 @@ export const cameraProjectionMatrixInverse = /*@__PURE__*/ ( Fn( ( { camera } )
|
|
|
83
83
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
const cameraProjectionMatricesInverse = uniformArray( matrices ).setGroup( renderGroup ).
|
|
86
|
+
const cameraProjectionMatricesInverse = uniformArray( matrices ).setGroup( renderGroup ).setName( 'cameraProjectionMatricesInverse' );
|
|
87
87
|
|
|
88
88
|
cameraProjectionMatrixInverse = cameraProjectionMatricesInverse.element( camera.isMultiViewCamera ? builtin( 'gl_ViewID_OVR' ) : cameraIndex ).toVar( 'cameraProjectionMatrixInverse' );
|
|
89
89
|
|
|
90
90
|
} else {
|
|
91
91
|
|
|
92
|
-
cameraProjectionMatrixInverse = uniform( 'mat4' ).
|
|
92
|
+
cameraProjectionMatrixInverse = uniform( 'mat4' ).setName( 'cameraProjectionMatrixInverse' ).setGroup( renderGroup ).onRenderUpdate( ( { camera } ) => camera.projectionMatrixInverse );
|
|
93
93
|
|
|
94
94
|
}
|
|
95
95
|
|
|
@@ -117,13 +117,13 @@ export const cameraViewMatrix = /*@__PURE__*/ ( Fn( ( { camera } ) => {
|
|
|
117
117
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
const cameraViewMatrices = uniformArray( matrices ).setGroup( renderGroup ).
|
|
120
|
+
const cameraViewMatrices = uniformArray( matrices ).setGroup( renderGroup ).setName( 'cameraViewMatrices' );
|
|
121
121
|
|
|
122
122
|
cameraViewMatrix = cameraViewMatrices.element( camera.isMultiViewCamera ? builtin( 'gl_ViewID_OVR' ) : cameraIndex ).toVar( 'cameraViewMatrix' );
|
|
123
123
|
|
|
124
124
|
} else {
|
|
125
125
|
|
|
126
|
-
cameraViewMatrix = uniform( 'mat4' ).
|
|
126
|
+
cameraViewMatrix = uniform( 'mat4' ).setName( 'cameraViewMatrix' ).setGroup( renderGroup ).onRenderUpdate( ( { camera } ) => camera.matrixWorldInverse );
|
|
127
127
|
|
|
128
128
|
}
|
|
129
129
|
|
|
@@ -137,7 +137,7 @@ export const cameraViewMatrix = /*@__PURE__*/ ( Fn( ( { camera } ) => {
|
|
|
137
137
|
* @tsl
|
|
138
138
|
* @type {UniformNode<mat4>}
|
|
139
139
|
*/
|
|
140
|
-
export const cameraWorldMatrix = /*@__PURE__*/ uniform( 'mat4' ).
|
|
140
|
+
export const cameraWorldMatrix = /*@__PURE__*/ uniform( 'mat4' ).setName( 'cameraWorldMatrix' ).setGroup( renderGroup ).onRenderUpdate( ( { camera } ) => camera.matrixWorld );
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
143
|
* TSL object that represents the normal matrix of the camera used for the current render.
|
|
@@ -145,7 +145,7 @@ export const cameraWorldMatrix = /*@__PURE__*/ uniform( 'mat4' ).label( 'cameraW
|
|
|
145
145
|
* @tsl
|
|
146
146
|
* @type {UniformNode<mat3>}
|
|
147
147
|
*/
|
|
148
|
-
export const cameraNormalMatrix = /*@__PURE__*/ uniform( 'mat3' ).
|
|
148
|
+
export const cameraNormalMatrix = /*@__PURE__*/ uniform( 'mat3' ).setName( 'cameraNormalMatrix' ).setGroup( renderGroup ).onRenderUpdate( ( { camera } ) => camera.normalMatrix );
|
|
149
149
|
|
|
150
150
|
/**
|
|
151
151
|
* TSL object that represents the position in world space of the camera used for the current render.
|
|
@@ -153,4 +153,4 @@ export const cameraNormalMatrix = /*@__PURE__*/ uniform( 'mat3' ).label( 'camera
|
|
|
153
153
|
* @tsl
|
|
154
154
|
* @type {UniformNode<vec3>}
|
|
155
155
|
*/
|
|
156
|
-
export const cameraPosition = /*@__PURE__*/ uniform( new Vector3() ).
|
|
156
|
+
export const cameraPosition = /*@__PURE__*/ uniform( new Vector3() ).setName( 'cameraPosition' ).setGroup( renderGroup ).onRenderUpdate( ( { camera }, self ) => self.value.setFromMatrixPosition( camera.matrixWorld ) );
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { attribute } from '../core/AttributeNode.js';
|
|
2
2
|
import { cameraViewMatrix } from './Camera.js';
|
|
3
3
|
import { modelNormalMatrix, modelWorldMatrix } from './ModelNode.js';
|
|
4
|
-
import { mat3, vec3, Fn
|
|
4
|
+
import { mat3, vec3, Fn } from '../tsl/TSLBase.js';
|
|
5
5
|
import { positionView } from './Position.js';
|
|
6
|
-
import {
|
|
6
|
+
import { directionToFaceDirection } from '../display/FrontFacingNode.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* TSL object that represents the normal attribute of the current rendered object.
|
|
9
|
+
* TSL object that represents the normal attribute of the current rendered object in local space.
|
|
10
10
|
*
|
|
11
11
|
* @tsl
|
|
12
12
|
* @type {Node<vec3>}
|
|
@@ -14,7 +14,7 @@ import { faceDirection } from '../display/FrontFacingNode.js';
|
|
|
14
14
|
export const normalGeometry = /*@__PURE__*/ attribute( 'normal', 'vec3' );
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* TSL object that represents the vertex normal
|
|
17
|
+
* TSL object that represents the vertex normal of the current rendered object in local space.
|
|
18
18
|
*
|
|
19
19
|
* @tsl
|
|
20
20
|
* @type {Node<vec3>}
|
|
@@ -34,7 +34,7 @@ export const normalLocal = /*@__PURE__*/ ( Fn( ( builder ) => {
|
|
|
34
34
|
}, 'vec3' ).once() )().toVar( 'normalLocal' );
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
* TSL object that represents the flat vertex normal
|
|
37
|
+
* TSL object that represents the flat vertex normal of the current rendered object in view space.
|
|
38
38
|
*
|
|
39
39
|
* @tsl
|
|
40
40
|
* @type {Node<vec3>}
|
|
@@ -42,12 +42,12 @@ export const normalLocal = /*@__PURE__*/ ( Fn( ( builder ) => {
|
|
|
42
42
|
export const normalFlat = /*@__PURE__*/ positionView.dFdx().cross( positionView.dFdy() ).normalize().toVar( 'normalFlat' );
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
* TSL object that represents the vertex normal
|
|
45
|
+
* TSL object that represents the vertex normal of the current rendered object in view space.
|
|
46
46
|
*
|
|
47
47
|
* @tsl
|
|
48
48
|
* @type {Node<vec3>}
|
|
49
49
|
*/
|
|
50
|
-
export const
|
|
50
|
+
export const normalViewGeometry = /*@__PURE__*/ ( Fn( ( builder ) => {
|
|
51
51
|
|
|
52
52
|
let node;
|
|
53
53
|
|
|
@@ -57,77 +57,99 @@ export const normalView = /*@__PURE__*/ ( Fn( ( builder ) => {
|
|
|
57
57
|
|
|
58
58
|
} else {
|
|
59
59
|
|
|
60
|
-
node =
|
|
60
|
+
node = transformNormalToView( normalLocal ).toVarying( 'v_normalViewGeometry' ).normalize();
|
|
61
61
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
return node;
|
|
65
65
|
|
|
66
|
-
}, 'vec3' ).once() )().toVar( '
|
|
66
|
+
}, 'vec3' ).once() )().toVar( 'normalViewGeometry' );
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
|
-
* TSL object that represents the vertex normal
|
|
69
|
+
* TSL object that represents the vertex normal of the current rendered object in world space.
|
|
70
70
|
*
|
|
71
71
|
* @tsl
|
|
72
72
|
* @type {Node<vec3>}
|
|
73
73
|
*/
|
|
74
|
-
export const
|
|
74
|
+
export const normalWorldGeometry = /*@__PURE__*/ ( Fn( ( builder ) => {
|
|
75
75
|
|
|
76
|
-
let normal =
|
|
76
|
+
let normal = normalViewGeometry.transformDirection( cameraViewMatrix );
|
|
77
77
|
|
|
78
78
|
if ( builder.material.flatShading !== true ) {
|
|
79
79
|
|
|
80
|
-
normal =
|
|
80
|
+
normal = normal.toVarying( 'v_normalWorldGeometry' );
|
|
81
81
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
return normal;
|
|
84
|
+
return normal.normalize().toVar( 'normalWorldGeometry' );
|
|
85
85
|
|
|
86
|
-
}, 'vec3' ).once() )()
|
|
86
|
+
}, 'vec3' ).once() )();
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
|
-
* TSL object that represents the
|
|
89
|
+
* TSL object that represents the vertex normal of the current rendered object in view space.
|
|
90
90
|
*
|
|
91
91
|
* @tsl
|
|
92
92
|
* @type {Node<vec3>}
|
|
93
93
|
*/
|
|
94
|
-
export const
|
|
94
|
+
export const normalView = /*@__PURE__*/ ( Fn( ( { subBuildFn, material, context } ) => {
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
let node;
|
|
97
|
+
|
|
98
|
+
if ( subBuildFn === 'NORMAL' || subBuildFn === 'VERTEX' ) {
|
|
99
|
+
|
|
100
|
+
node = normalViewGeometry;
|
|
97
101
|
|
|
98
|
-
|
|
102
|
+
if ( material.flatShading !== true ) {
|
|
99
103
|
|
|
100
|
-
|
|
104
|
+
node = directionToFaceDirection( node );
|
|
105
|
+
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
} else {
|
|
109
|
+
|
|
110
|
+
// Use getUV context to avoid side effects from nodes overwriting getUV in the context (e.g. EnvironmentNode)
|
|
111
|
+
|
|
112
|
+
node = context.setupNormal().context( { getUV: null } );
|
|
113
|
+
|
|
114
|
+
}
|
|
101
115
|
|
|
102
116
|
return node;
|
|
103
117
|
|
|
104
|
-
}, 'vec3' ).once() )().toVar( '
|
|
118
|
+
}, 'vec3' ).once( [ 'NORMAL', 'VERTEX' ] ) )().toVar( 'normalView' );
|
|
105
119
|
|
|
106
120
|
/**
|
|
107
|
-
* TSL object that represents the
|
|
121
|
+
* TSL object that represents the vertex normal of the current rendered object in world space.
|
|
108
122
|
*
|
|
109
123
|
* @tsl
|
|
110
124
|
* @type {Node<vec3>}
|
|
111
125
|
*/
|
|
112
|
-
export const
|
|
126
|
+
export const normalWorld = /*@__PURE__*/ normalView.transformDirection( cameraViewMatrix ).toVar( 'normalWorld' );
|
|
113
127
|
|
|
114
128
|
/**
|
|
115
|
-
* TSL object that represents the
|
|
129
|
+
* TSL object that represents the clearcoat vertex normal of the current rendered object in view space.
|
|
116
130
|
*
|
|
117
131
|
* @tsl
|
|
118
132
|
* @type {Node<vec3>}
|
|
119
133
|
*/
|
|
120
|
-
export const
|
|
134
|
+
export const clearcoatNormalView = /*@__PURE__*/ ( Fn( ( { subBuildFn, context } ) => {
|
|
121
135
|
|
|
122
|
-
|
|
136
|
+
let node;
|
|
123
137
|
|
|
124
|
-
|
|
138
|
+
if ( subBuildFn === 'NORMAL' || subBuildFn === 'VERTEX' ) {
|
|
125
139
|
|
|
126
|
-
|
|
140
|
+
node = normalView;
|
|
141
|
+
|
|
142
|
+
} else {
|
|
143
|
+
|
|
144
|
+
// Use getUV context to avoid side effects from nodes overwriting getUV in the context (e.g. EnvironmentNode)
|
|
145
|
+
|
|
146
|
+
node = context.setupClearcoatNormal().context( { getUV: null } );
|
|
147
|
+
|
|
148
|
+
}
|
|
127
149
|
|
|
128
150
|
return node;
|
|
129
151
|
|
|
130
|
-
}, 'vec3' ).once() )().toVar( '
|
|
152
|
+
}, 'vec3' ).once( [ 'NORMAL', 'VERTEX' ] ) )().toVar( 'clearcoatNormalView' );
|
|
131
153
|
|
|
132
154
|
/**
|
|
133
155
|
* Transforms the normal with the given matrix.
|
|
@@ -174,3 +196,47 @@ export const transformNormalToView = /*@__PURE__*/ Fn( ( [ normal ], builder ) =
|
|
|
174
196
|
return cameraViewMatrix.transformDirection( transformedNormal );
|
|
175
197
|
|
|
176
198
|
} );
|
|
199
|
+
|
|
200
|
+
// Deprecated
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* TSL object that represents the transformed vertex normal of the current rendered object in view space.
|
|
204
|
+
*
|
|
205
|
+
* @tsl
|
|
206
|
+
* @type {Node<vec3>}
|
|
207
|
+
* @deprecated since r178. Use `normalView` instead.
|
|
208
|
+
*/
|
|
209
|
+
export const transformedNormalView = ( Fn( () => { // @deprecated, r177
|
|
210
|
+
|
|
211
|
+
console.warn( 'THREE.TSL: "transformedNormalView" is deprecated. Use "normalView" instead.' );
|
|
212
|
+
return normalView;
|
|
213
|
+
|
|
214
|
+
} ).once( [ 'NORMAL', 'VERTEX' ] ) )();
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* TSL object that represents the transformed vertex normal of the current rendered object in world space.
|
|
218
|
+
*
|
|
219
|
+
* @tsl
|
|
220
|
+
* @type {Node<vec3>}
|
|
221
|
+
* @deprecated since r178. Use `normalWorld` instead.
|
|
222
|
+
*/
|
|
223
|
+
export const transformedNormalWorld = ( Fn( () => { // @deprecated, r177
|
|
224
|
+
|
|
225
|
+
console.warn( 'THREE.TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.' );
|
|
226
|
+
return normalWorld;
|
|
227
|
+
|
|
228
|
+
} ).once( [ 'NORMAL', 'VERTEX' ] ) )();
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* TSL object that represents the transformed clearcoat vertex normal of the current rendered object in view space.
|
|
232
|
+
*
|
|
233
|
+
* @tsl
|
|
234
|
+
* @type {Node<vec3>}
|
|
235
|
+
* @deprecated since r178. Use `clearcoatNormalView` instead.
|
|
236
|
+
*/
|
|
237
|
+
export const transformedClearcoatNormalView = ( Fn( () => { // @deprecated, r177
|
|
238
|
+
|
|
239
|
+
console.warn( 'THREE.TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.' );
|
|
240
|
+
return clearcoatNormalView;
|
|
241
|
+
|
|
242
|
+
} ).once( [ 'NORMAL', 'VERTEX' ] ) )();
|
|
@@ -263,6 +263,6 @@ export const objectViewPosition = /*@__PURE__*/ nodeProxy( Object3DNode, Object3
|
|
|
263
263
|
* @tsl
|
|
264
264
|
* @function
|
|
265
265
|
* @param {?Object3D} [object3d] - The 3D object.
|
|
266
|
-
* @returns {Object3DNode<
|
|
266
|
+
* @returns {Object3DNode<float>}
|
|
267
267
|
*/
|
|
268
268
|
export const objectRadius = /*@__PURE__*/ nodeProxy( Object3DNode, Object3DNode.RADIUS ).setParameterLength( 1 );
|