@plastic-software/three 0.178.0 → 0.180.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 +950 -230
- package/build/three.core.js +754 -138
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +197 -96
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +99 -25
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +4586 -1499
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +4544 -1499
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +2 -3
- package/examples/jsm/capabilities/WebGPU.js +1 -1
- package/examples/jsm/controls/ArcballControls.js +7 -7
- package/examples/jsm/controls/DragControls.js +6 -56
- package/examples/jsm/controls/FirstPersonControls.js +2 -2
- package/examples/jsm/controls/PointerLockControls.js +0 -8
- package/examples/jsm/csm/CSMShadowNode.js +4 -4
- package/examples/jsm/environments/RoomEnvironment.js +8 -3
- package/examples/jsm/exporters/GLTFExporter.js +30 -22
- package/examples/jsm/exporters/KTX2Exporter.js +4 -2
- package/examples/jsm/exporters/PLYExporter.js +1 -1
- 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/ktx-parse.module.js +1 -1
- package/examples/jsm/libs/meshopt_decoder.module.js +75 -58
- package/examples/jsm/lights/LightProbeGenerator.js +14 -3
- package/examples/jsm/lines/Line2.js +3 -3
- package/examples/jsm/lines/LineGeometry.js +1 -1
- package/examples/jsm/lines/LineSegments2.js +2 -2
- package/examples/jsm/lines/Wireframe.js +2 -2
- package/examples/jsm/lines/WireframeGeometry2.js +1 -1
- package/examples/jsm/lines/webgpu/LineSegments2.js +1 -1
- package/examples/jsm/lines/webgpu/Wireframe.js +1 -1
- package/examples/jsm/loaders/ColladaLoader.js +1 -1
- package/examples/jsm/loaders/EXRLoader.js +210 -22
- package/examples/jsm/loaders/FBXLoader.js +1 -1
- package/examples/jsm/loaders/GLTFLoader.js +9 -5
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +5 -5
- package/examples/jsm/loaders/HDRLoader.js +486 -0
- package/examples/jsm/loaders/KTX2Loader.js +112 -32
- package/examples/jsm/loaders/MaterialXLoader.js +212 -30
- package/examples/jsm/loaders/RGBELoader.js +7 -473
- 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/UltraHDRLoader.js +1 -1
- package/examples/jsm/loaders/lwo/IFFParser.js +1 -1
- package/examples/jsm/loaders/usd/USDAParser.js +741 -0
- package/examples/jsm/loaders/usd/USDCParser.js +17 -0
- package/examples/jsm/materials/WoodNodeMaterial.js +533 -0
- package/examples/jsm/math/ColorSpaces.js +19 -1
- package/examples/jsm/math/ConvexHull.js +2 -2
- package/examples/jsm/math/Lut.js +2 -2
- package/examples/jsm/misc/MD2CharacterComplex.js +1 -1
- package/examples/jsm/misc/ProgressiveLightMap.js +1 -1
- package/examples/jsm/misc/Volume.js +1 -1
- package/examples/jsm/objects/LensflareMesh.js +3 -3
- package/examples/jsm/objects/SkyMesh.js +2 -2
- package/examples/jsm/physics/RapierPhysics.js +14 -5
- 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/postprocessing/SSRPass.js +37 -8
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +11 -2
- package/examples/jsm/transpiler/GLSLDecoder.js +23 -20
- package/examples/jsm/transpiler/TSLEncoder.js +2 -10
- package/examples/jsm/transpiler/WGSLEncoder.js +24 -0
- package/examples/jsm/tsl/display/AnamorphicNode.js +27 -4
- package/examples/jsm/tsl/display/BloomNode.js +7 -6
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +2 -1
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +439 -90
- package/examples/jsm/tsl/display/GTAONode.js +8 -0
- package/examples/jsm/tsl/display/GaussianBlurNode.js +51 -41
- package/examples/jsm/tsl/display/OutlineNode.js +2 -2
- package/examples/jsm/tsl/display/SSRNode.js +180 -65
- package/examples/jsm/tsl/display/{TRAAPassNode.js → TRAANode.js} +181 -172
- package/examples/jsm/tsl/display/boxBlur.js +64 -0
- package/examples/jsm/tsl/display/hashBlur.js +15 -18
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +1 -1
- package/examples/jsm/utils/BufferGeometryUtils.js +1 -1
- package/examples/jsm/utils/ShadowMapViewerGPU.js +12 -5
- package/examples/jsm/webxr/OculusHandModel.js +1 -1
- package/package.json +1 -1
- package/src/Three.Core.js +2 -0
- package/src/Three.TSL.js +98 -24
- package/src/animation/AnimationClip.js +17 -2
- 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 +11 -3
- package/src/core/BufferGeometry.js +2 -2
- package/{examples/jsm/misc → src/core}/Timer.js +4 -42
- package/src/extras/PMREMGenerator.js +11 -0
- package/src/extras/TextureUtils.js +2 -1
- package/src/extras/lib/earcut.js +1 -1
- 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/lights/webgpu/ProjectorLight.js +1 -1
- package/src/loaders/FileLoader.js +25 -2
- package/src/loaders/ImageBitmapLoader.js +23 -0
- package/src/loaders/Loader.js +14 -0
- package/src/loaders/LoadingManager.js +23 -0
- package/src/materials/Material.js +12 -0
- package/src/materials/MeshBasicMaterial.js +1 -1
- package/src/materials/MeshDistanceMaterial.js +1 -1
- package/src/materials/nodes/Line2NodeMaterial.js +0 -8
- package/src/materials/nodes/NodeMaterial.js +1 -1
- package/src/materials/nodes/PointsNodeMaterial.js +86 -28
- package/src/materials/nodes/SpriteNodeMaterial.js +3 -15
- package/src/materials/nodes/manager/NodeMaterialObserver.js +87 -2
- package/src/math/ColorManagement.js +7 -1
- package/src/math/Frustum.js +19 -8
- package/src/math/FrustumArray.js +10 -5
- package/src/math/Line3.js +129 -2
- package/src/math/Matrix4.js +48 -27
- package/src/math/Spherical.js +2 -2
- package/src/nodes/Nodes.js +4 -0
- package/src/nodes/TSL.js +4 -0
- package/src/nodes/accessors/BufferNode.js +1 -1
- package/src/nodes/accessors/Camera.js +142 -16
- package/src/nodes/accessors/ClippingNode.js +6 -5
- package/src/nodes/accessors/CubeTextureNode.js +2 -2
- package/src/nodes/accessors/InstanceNode.js +3 -1
- package/src/nodes/accessors/Normal.js +11 -11
- package/src/nodes/accessors/Object3DNode.js +1 -1
- package/src/nodes/accessors/ReferenceBaseNode.js +1 -1
- package/src/nodes/accessors/ReferenceNode.js +19 -4
- package/src/nodes/accessors/SceneNode.js +1 -1
- package/src/nodes/accessors/StorageTextureNode.js +1 -1
- package/src/nodes/accessors/Texture3DNode.js +13 -0
- package/src/nodes/accessors/TextureNode.js +83 -19
- package/src/nodes/code/FunctionCallNode.js +19 -0
- package/src/nodes/code/FunctionNode.js +23 -0
- package/src/nodes/core/ArrayNode.js +12 -0
- package/src/nodes/core/AssignNode.js +6 -2
- package/src/nodes/core/ContextNode.js +44 -1
- package/src/nodes/core/Node.js +30 -22
- package/src/nodes/core/NodeBuilder.js +71 -32
- package/src/nodes/core/NodeFrame.js +1 -1
- package/src/nodes/core/NodeUniform.js +1 -1
- package/src/nodes/core/NodeUtils.js +5 -3
- package/src/nodes/core/StackNode.js +71 -4
- package/src/nodes/core/StructNode.js +5 -5
- package/src/nodes/core/StructTypeNode.js +1 -0
- package/src/nodes/core/SubBuildNode.js +2 -2
- package/src/nodes/core/UniformNode.js +79 -14
- package/src/nodes/core/VarNode.js +83 -15
- package/src/nodes/display/FrontFacingNode.js +4 -8
- package/src/nodes/display/PassNode.js +148 -2
- package/src/nodes/display/ScreenNode.js +42 -13
- package/src/nodes/display/ViewportDepthTextureNode.js +16 -4
- package/src/nodes/display/ViewportSharedTextureNode.js +12 -0
- package/src/nodes/display/ViewportTextureNode.js +94 -4
- package/src/nodes/functions/PhysicalLightingModel.js +2 -2
- package/src/nodes/gpgpu/AtomicFunctionNode.js +1 -1
- package/src/nodes/gpgpu/ComputeNode.js +67 -23
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +430 -0
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +28 -3
- package/src/nodes/lighting/LightsNode.js +1 -1
- package/src/nodes/lighting/ProjectorLightNode.js +19 -6
- package/src/nodes/lighting/ShadowFilterNode.js +1 -1
- package/src/nodes/materialx/MaterialXNodes.js +131 -2
- package/src/nodes/materialx/lib/mx_noise.js +165 -1
- package/src/nodes/math/BitcastNode.js +156 -0
- package/src/nodes/math/ConditionalNode.js +19 -3
- package/src/nodes/math/MathNode.js +72 -60
- package/src/nodes/math/OperatorNode.js +26 -25
- package/src/nodes/tsl/TSLCore.js +477 -142
- package/src/nodes/utils/DebugNode.js +1 -1
- package/src/nodes/utils/EventNode.js +83 -0
- package/src/nodes/utils/JoinNode.js +3 -1
- package/src/nodes/utils/MemberNode.js +58 -7
- package/src/nodes/utils/RTTNode.js +10 -1
- package/src/nodes/utils/ReflectorNode.js +51 -7
- package/src/nodes/utils/SampleNode.js +12 -2
- package/src/nodes/utils/SplitNode.js +11 -0
- package/src/nodes/utils/Timer.js +0 -47
- package/src/objects/BatchedMesh.js +6 -4
- package/src/objects/LOD.js +1 -1
- package/src/objects/Sprite.js +2 -2
- package/src/renderers/WebGLRenderer.js +21 -31
- package/src/renderers/common/Attributes.js +1 -1
- package/src/renderers/common/Backend.js +19 -1
- package/src/renderers/common/Bindings.js +21 -18
- package/src/renderers/common/ChainMap.js +1 -1
- package/src/renderers/common/Color4.js +2 -2
- package/src/renderers/common/DataMap.js +1 -1
- package/src/renderers/common/Pipelines.js +1 -1
- package/src/renderers/common/PostProcessing.js +60 -5
- package/src/renderers/common/RenderContext.js +2 -2
- package/src/renderers/common/RenderObject.js +14 -2
- package/src/renderers/common/Renderer.js +55 -32
- package/src/renderers/common/SampledTexture.js +4 -72
- package/src/renderers/common/Sampler.js +91 -0
- package/src/renderers/common/Storage3DTexture.js +21 -0
- package/src/renderers/common/StorageArrayTexture.js +21 -0
- package/src/renderers/common/StorageTexture.js +19 -0
- package/src/renderers/common/Textures.js +52 -14
- package/src/renderers/common/TimestampQueryPool.js +3 -3
- package/src/renderers/common/XRManager.js +51 -17
- package/src/renderers/common/nodes/NodeBuilderState.js +1 -1
- package/src/renderers/common/nodes/NodeLibrary.js +5 -5
- package/src/renderers/common/nodes/NodeSampledTexture.js +0 -12
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +21 -11
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +11 -2
- package/src/renderers/webgl/WebGLCapabilities.js +2 -2
- package/src/renderers/webgl/WebGLMaterials.js +6 -6
- package/src/renderers/webgl/WebGLProgram.js +24 -18
- package/src/renderers/webgl/WebGLPrograms.js +4 -4
- package/src/renderers/webgl/WebGLShadowMap.js +11 -1
- package/src/renderers/webgl/WebGLTextures.js +20 -7
- package/src/renderers/webgl/WebGLUtils.js +3 -2
- package/src/renderers/webgl-fallback/WebGLBackend.js +207 -146
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +112 -19
- package/src/renderers/webgl-fallback/utils/WebGLState.js +1 -1
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +52 -3
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +9 -10
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +3 -2
- package/src/renderers/webgpu/WebGPUBackend.js +87 -44
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +169 -99
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +35 -31
- package/src/renderers/webgpu/utils/WebGPUConstants.js +2 -2
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +10 -19
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +120 -84
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +3 -3
- package/src/renderers/webgpu/utils/WebGPUUtils.js +2 -17
- package/src/renderers/webxr/WebXRDepthSensing.js +6 -10
- package/src/renderers/webxr/WebXRManager.js +86 -11
- package/src/textures/ExternalTexture.js +56 -0
- package/src/textures/FramebufferTexture.js +2 -2
- package/src/textures/Source.js +12 -2
- package/src/textures/VideoTexture.js +27 -2
- package/examples/jsm/loaders/RGBMLoader.js +0 -1148
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/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
|
@@ -55,6 +55,10 @@ export { default as ReflectorNode } from './utils/ReflectorNode.js';
|
|
|
55
55
|
export { default as RTTNode } from './utils/RTTNode.js';
|
|
56
56
|
export { default as MemberNode } from './utils/MemberNode.js';
|
|
57
57
|
export { default as DebugNode } from './utils/DebugNode.js';
|
|
58
|
+
export { default as EventNode } from './utils/EventNode.js';
|
|
59
|
+
|
|
60
|
+
// math
|
|
61
|
+
export { default as BitcastNode } from './math/BitcastNode.js';
|
|
58
62
|
|
|
59
63
|
// accessors
|
|
60
64
|
export { default as UniformArrayNode } from './accessors/UniformArrayNode.js';
|
package/src/nodes/TSL.js
CHANGED
|
@@ -19,6 +19,7 @@ export * from './core/OutputStructNode.js';
|
|
|
19
19
|
export * from './core/MRTNode.js';
|
|
20
20
|
|
|
21
21
|
// math
|
|
22
|
+
export * from './math/BitcastNode.js';
|
|
22
23
|
export * from './math/Hash.js';
|
|
23
24
|
export * from './math/MathUtils.js';
|
|
24
25
|
export * from './math/TriNoise3D.js';
|
|
@@ -43,6 +44,7 @@ export * from './utils/ReflectorNode.js';
|
|
|
43
44
|
export * from './utils/RTTNode.js';
|
|
44
45
|
export * from './utils/PostProcessingUtils.js';
|
|
45
46
|
export * from './utils/SampleNode.js';
|
|
47
|
+
export * from './utils/EventNode.js';
|
|
46
48
|
|
|
47
49
|
// three.js shading language
|
|
48
50
|
export * from './tsl/TSLBase.js';
|
|
@@ -54,6 +56,7 @@ export * from './accessors/UniformArrayNode.js';
|
|
|
54
56
|
export * from './accessors/Bitangent.js';
|
|
55
57
|
export * from './accessors/BufferAttributeNode.js';
|
|
56
58
|
export * from './accessors/BufferNode.js';
|
|
59
|
+
export * from './accessors/BuiltinNode.js';
|
|
57
60
|
export * from './accessors/Camera.js';
|
|
58
61
|
export * from './accessors/VertexColorNode.js';
|
|
59
62
|
export * from './accessors/CubeTextureNode.js';
|
|
@@ -128,6 +131,7 @@ export * from './gpgpu/ComputeBuiltinNode.js';
|
|
|
128
131
|
export * from './gpgpu/BarrierNode.js';
|
|
129
132
|
export * from './gpgpu/WorkgroupInfoNode.js';
|
|
130
133
|
export * from './gpgpu/AtomicFunctionNode.js';
|
|
134
|
+
export * from './gpgpu/SubgroupFunctionNode.js';
|
|
131
135
|
|
|
132
136
|
// lighting
|
|
133
137
|
export * from './accessors/Lights.js';
|
|
@@ -93,7 +93,7 @@ export default BufferNode;
|
|
|
93
93
|
*
|
|
94
94
|
* @tsl
|
|
95
95
|
* @function
|
|
96
|
-
* @param {Array} value - Array-like buffer data.
|
|
96
|
+
* @param {Array<number>} value - Array-like buffer data.
|
|
97
97
|
* @param {string} type - The data type of a buffer element.
|
|
98
98
|
* @param {number} count - The count of buffer elements.
|
|
99
99
|
* @returns {BufferNode}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { uniform } from '../core/UniformNode.js';
|
|
2
2
|
import { renderGroup, sharedUniformGroup } from '../core/UniformGroupNode.js';
|
|
3
3
|
import { Vector3 } from '../../math/Vector3.js';
|
|
4
|
-
import { Fn } from '../tsl/TSLBase.js';
|
|
4
|
+
import { Fn, vec4 } from '../tsl/TSLBase.js';
|
|
5
5
|
import { uniformArray } from './UniformArrayNode.js';
|
|
6
6
|
import { builtin } from './BuiltinNode.js';
|
|
7
|
+
import { screenSize } from '../display/ScreenNode.js';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* TSL object that represents the current `index` value of the camera if used ArrayCamera.
|
|
@@ -11,7 +12,7 @@ import { builtin } from './BuiltinNode.js';
|
|
|
11
12
|
* @tsl
|
|
12
13
|
* @type {UniformNode<uint>}
|
|
13
14
|
*/
|
|
14
|
-
export const cameraIndex = /*@__PURE__*/ uniform( 0, 'uint' ).
|
|
15
|
+
export const cameraIndex = /*@__PURE__*/ uniform( 0, 'uint' ).setName( 'u_cameraIndex' ).setGroup( sharedUniformGroup( 'cameraIndex' ) ).toVarying( 'v_cameraIndex' );
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* TSL object that represents the `near` value of the camera used for the current render.
|
|
@@ -19,7 +20,7 @@ export const cameraIndex = /*@__PURE__*/ uniform( 0, 'uint' ).label( 'u_cameraIn
|
|
|
19
20
|
* @tsl
|
|
20
21
|
* @type {UniformNode<float>}
|
|
21
22
|
*/
|
|
22
|
-
export const cameraNear = /*@__PURE__*/ uniform( 'float' ).
|
|
23
|
+
export const cameraNear = /*@__PURE__*/ uniform( 'float' ).setName( 'cameraNear' ).setGroup( renderGroup ).onRenderUpdate( ( { camera } ) => camera.near );
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* TSL object that represents the `far` value of the camera used for the current render.
|
|
@@ -27,7 +28,7 @@ export const cameraNear = /*@__PURE__*/ uniform( 'float' ).label( 'cameraNear' )
|
|
|
27
28
|
* @tsl
|
|
28
29
|
* @type {UniformNode<float>}
|
|
29
30
|
*/
|
|
30
|
-
export const cameraFar = /*@__PURE__*/ uniform( 'float' ).
|
|
31
|
+
export const cameraFar = /*@__PURE__*/ uniform( 'float' ).setName( 'cameraFar' ).setGroup( renderGroup ).onRenderUpdate( ( { camera } ) => camera.far );
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
34
|
* TSL object that represents the projection matrix of the camera used for the current render.
|
|
@@ -49,13 +50,13 @@ export const cameraProjectionMatrix = /*@__PURE__*/ ( Fn( ( { camera } ) => {
|
|
|
49
50
|
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
const cameraProjectionMatrices = uniformArray( matrices ).setGroup( renderGroup ).
|
|
53
|
+
const cameraProjectionMatrices = uniformArray( matrices ).setGroup( renderGroup ).setName( 'cameraProjectionMatrices' );
|
|
53
54
|
|
|
54
|
-
cameraProjectionMatrix = cameraProjectionMatrices.element( camera.isMultiViewCamera ? builtin( 'gl_ViewID_OVR' ) : cameraIndex ).
|
|
55
|
+
cameraProjectionMatrix = cameraProjectionMatrices.element( camera.isMultiViewCamera ? builtin( 'gl_ViewID_OVR' ) : cameraIndex ).toConst( 'cameraProjectionMatrix' );
|
|
55
56
|
|
|
56
57
|
} else {
|
|
57
58
|
|
|
58
|
-
cameraProjectionMatrix = uniform( 'mat4' ).
|
|
59
|
+
cameraProjectionMatrix = uniform( 'mat4' ).setName( 'cameraProjectionMatrix' ).setGroup( renderGroup ).onRenderUpdate( ( { camera } ) => camera.projectionMatrix );
|
|
59
60
|
|
|
60
61
|
}
|
|
61
62
|
|
|
@@ -83,13 +84,13 @@ export const cameraProjectionMatrixInverse = /*@__PURE__*/ ( Fn( ( { camera } )
|
|
|
83
84
|
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
const cameraProjectionMatricesInverse = uniformArray( matrices ).setGroup( renderGroup ).
|
|
87
|
+
const cameraProjectionMatricesInverse = uniformArray( matrices ).setGroup( renderGroup ).setName( 'cameraProjectionMatricesInverse' );
|
|
87
88
|
|
|
88
|
-
cameraProjectionMatrixInverse = cameraProjectionMatricesInverse.element( camera.isMultiViewCamera ? builtin( 'gl_ViewID_OVR' ) : cameraIndex ).
|
|
89
|
+
cameraProjectionMatrixInverse = cameraProjectionMatricesInverse.element( camera.isMultiViewCamera ? builtin( 'gl_ViewID_OVR' ) : cameraIndex ).toConst( 'cameraProjectionMatrixInverse' );
|
|
89
90
|
|
|
90
91
|
} else {
|
|
91
92
|
|
|
92
|
-
cameraProjectionMatrixInverse = uniform( 'mat4' ).
|
|
93
|
+
cameraProjectionMatrixInverse = uniform( 'mat4' ).setName( 'cameraProjectionMatrixInverse' ).setGroup( renderGroup ).onRenderUpdate( ( { camera } ) => camera.projectionMatrixInverse );
|
|
93
94
|
|
|
94
95
|
}
|
|
95
96
|
|
|
@@ -117,13 +118,13 @@ export const cameraViewMatrix = /*@__PURE__*/ ( Fn( ( { camera } ) => {
|
|
|
117
118
|
|
|
118
119
|
}
|
|
119
120
|
|
|
120
|
-
const cameraViewMatrices = uniformArray( matrices ).setGroup( renderGroup ).
|
|
121
|
+
const cameraViewMatrices = uniformArray( matrices ).setGroup( renderGroup ).setName( 'cameraViewMatrices' );
|
|
121
122
|
|
|
122
|
-
cameraViewMatrix = cameraViewMatrices.element( camera.isMultiViewCamera ? builtin( 'gl_ViewID_OVR' ) : cameraIndex ).
|
|
123
|
+
cameraViewMatrix = cameraViewMatrices.element( camera.isMultiViewCamera ? builtin( 'gl_ViewID_OVR' ) : cameraIndex ).toConst( 'cameraViewMatrix' );
|
|
123
124
|
|
|
124
125
|
} else {
|
|
125
126
|
|
|
126
|
-
cameraViewMatrix = uniform( 'mat4' ).
|
|
127
|
+
cameraViewMatrix = uniform( 'mat4' ).setName( 'cameraViewMatrix' ).setGroup( renderGroup ).onRenderUpdate( ( { camera } ) => camera.matrixWorldInverse );
|
|
127
128
|
|
|
128
129
|
}
|
|
129
130
|
|
|
@@ -137,7 +138,33 @@ export const cameraViewMatrix = /*@__PURE__*/ ( Fn( ( { camera } ) => {
|
|
|
137
138
|
* @tsl
|
|
138
139
|
* @type {UniformNode<mat4>}
|
|
139
140
|
*/
|
|
140
|
-
export const cameraWorldMatrix = /*@__PURE__*/
|
|
141
|
+
export const cameraWorldMatrix = /*@__PURE__*/ ( Fn( ( { camera } ) => {
|
|
142
|
+
|
|
143
|
+
let cameraWorldMatrix;
|
|
144
|
+
|
|
145
|
+
if ( camera.isArrayCamera && camera.cameras.length > 0 ) {
|
|
146
|
+
|
|
147
|
+
const matrices = [];
|
|
148
|
+
|
|
149
|
+
for ( const subCamera of camera.cameras ) {
|
|
150
|
+
|
|
151
|
+
matrices.push( subCamera.matrixWorld );
|
|
152
|
+
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const cameraWorldMatrices = uniformArray( matrices ).setGroup( renderGroup ).setName( 'cameraWorldMatrices' );
|
|
156
|
+
|
|
157
|
+
cameraWorldMatrix = cameraWorldMatrices.element( camera.isMultiViewCamera ? builtin( 'gl_ViewID_OVR' ) : cameraIndex ).toConst( 'cameraWorldMatrix' );
|
|
158
|
+
|
|
159
|
+
} else {
|
|
160
|
+
|
|
161
|
+
cameraWorldMatrix = uniform( 'mat4' ).setName( 'cameraWorldMatrix' ).setGroup( renderGroup ).onRenderUpdate( ( { camera } ) => camera.matrixWorld );
|
|
162
|
+
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return cameraWorldMatrix;
|
|
166
|
+
|
|
167
|
+
} ).once() )();
|
|
141
168
|
|
|
142
169
|
/**
|
|
143
170
|
* TSL object that represents the normal matrix of the camera used for the current render.
|
|
@@ -145,7 +172,33 @@ export const cameraWorldMatrix = /*@__PURE__*/ uniform( 'mat4' ).label( 'cameraW
|
|
|
145
172
|
* @tsl
|
|
146
173
|
* @type {UniformNode<mat3>}
|
|
147
174
|
*/
|
|
148
|
-
export const cameraNormalMatrix = /*@__PURE__*/
|
|
175
|
+
export const cameraNormalMatrix = /*@__PURE__*/ ( Fn( ( { camera } ) => {
|
|
176
|
+
|
|
177
|
+
let cameraNormalMatrix;
|
|
178
|
+
|
|
179
|
+
if ( camera.isArrayCamera && camera.cameras.length > 0 ) {
|
|
180
|
+
|
|
181
|
+
const matrices = [];
|
|
182
|
+
|
|
183
|
+
for ( const subCamera of camera.cameras ) {
|
|
184
|
+
|
|
185
|
+
matrices.push( subCamera.normalMatrix );
|
|
186
|
+
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const cameraNormalMatrices = uniformArray( matrices ).setGroup( renderGroup ).setName( 'cameraNormalMatrices' );
|
|
190
|
+
|
|
191
|
+
cameraNormalMatrix = cameraNormalMatrices.element( camera.isMultiViewCamera ? builtin( 'gl_ViewID_OVR' ) : cameraIndex ).toConst( 'cameraNormalMatrix' );
|
|
192
|
+
|
|
193
|
+
} else {
|
|
194
|
+
|
|
195
|
+
cameraNormalMatrix = uniform( 'mat3' ).setName( 'cameraNormalMatrix' ).setGroup( renderGroup ).onRenderUpdate( ( { camera } ) => camera.normalMatrix );
|
|
196
|
+
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return cameraNormalMatrix;
|
|
200
|
+
|
|
201
|
+
} ).once() )();
|
|
149
202
|
|
|
150
203
|
/**
|
|
151
204
|
* TSL object that represents the position in world space of the camera used for the current render.
|
|
@@ -153,4 +206,77 @@ export const cameraNormalMatrix = /*@__PURE__*/ uniform( 'mat3' ).label( 'camera
|
|
|
153
206
|
* @tsl
|
|
154
207
|
* @type {UniformNode<vec3>}
|
|
155
208
|
*/
|
|
156
|
-
export const cameraPosition = /*@__PURE__*/
|
|
209
|
+
export const cameraPosition = /*@__PURE__*/ ( Fn( ( { camera } ) => {
|
|
210
|
+
|
|
211
|
+
let cameraPosition;
|
|
212
|
+
|
|
213
|
+
if ( camera.isArrayCamera && camera.cameras.length > 0 ) {
|
|
214
|
+
|
|
215
|
+
const positions = [];
|
|
216
|
+
|
|
217
|
+
for ( let i = 0, l = camera.cameras.length; i < l; i ++ ) {
|
|
218
|
+
|
|
219
|
+
positions.push( new Vector3() );
|
|
220
|
+
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const cameraPositions = uniformArray( positions ).setGroup( renderGroup ).setName( 'cameraPositions' ).onRenderUpdate( ( { camera }, self ) => {
|
|
224
|
+
|
|
225
|
+
const subCameras = camera.cameras;
|
|
226
|
+
const array = self.array;
|
|
227
|
+
|
|
228
|
+
for ( let i = 0, l = subCameras.length; i < l; i ++ ) {
|
|
229
|
+
|
|
230
|
+
array[ i ].setFromMatrixPosition( subCameras[ i ].matrixWorld );
|
|
231
|
+
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
} );
|
|
235
|
+
|
|
236
|
+
cameraPosition = cameraPositions.element( camera.isMultiViewCamera ? builtin( 'gl_ViewID_OVR' ) : cameraIndex ).toConst( 'cameraPosition' );
|
|
237
|
+
|
|
238
|
+
} else {
|
|
239
|
+
|
|
240
|
+
cameraPosition = uniform( new Vector3() ).setName( 'cameraPosition' ).setGroup( renderGroup ).onRenderUpdate( ( { camera }, self ) => self.value.setFromMatrixPosition( camera.matrixWorld ) );
|
|
241
|
+
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return cameraPosition;
|
|
245
|
+
|
|
246
|
+
} ).once() )();
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* TSL object that represents the viewport of the camera used for the current render.
|
|
251
|
+
*
|
|
252
|
+
* @tsl
|
|
253
|
+
* @type {UniformNode<vec4>}
|
|
254
|
+
*/
|
|
255
|
+
export const cameraViewport = /*@__PURE__*/ ( Fn( ( { camera } ) => {
|
|
256
|
+
|
|
257
|
+
let cameraViewport;
|
|
258
|
+
|
|
259
|
+
if ( camera.isArrayCamera && camera.cameras.length > 0 ) {
|
|
260
|
+
|
|
261
|
+
const viewports = [];
|
|
262
|
+
|
|
263
|
+
for ( const subCamera of camera.cameras ) {
|
|
264
|
+
|
|
265
|
+
viewports.push( subCamera.viewport );
|
|
266
|
+
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const cameraViewports = uniformArray( viewports, 'vec4' ).setGroup( renderGroup ).setName( 'cameraViewports' );
|
|
270
|
+
|
|
271
|
+
cameraViewport = cameraViewports.element( cameraIndex ).toConst( 'cameraViewport' );
|
|
272
|
+
|
|
273
|
+
} else {
|
|
274
|
+
|
|
275
|
+
// Fallback for single camera
|
|
276
|
+
cameraViewport = vec4( 0, 0, screenSize.x, screenSize.y ).toConst( 'cameraViewport' );
|
|
277
|
+
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
return cameraViewport;
|
|
281
|
+
|
|
282
|
+
} ).once() )();
|
|
@@ -7,6 +7,7 @@ import { Loop } from '../utils/LoopNode.js';
|
|
|
7
7
|
import { smoothstep } from '../math/MathNode.js';
|
|
8
8
|
import { uniformArray } from './UniformArrayNode.js';
|
|
9
9
|
import { builtin } from './BuiltinNode.js';
|
|
10
|
+
import { renderGroup } from '../core/UniformGroupNode.js';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* This node is used in {@link NodeMaterial} to setup the clipping
|
|
@@ -94,7 +95,7 @@ class ClippingNode extends Node {
|
|
|
94
95
|
|
|
95
96
|
if ( this.hardwareClipping === false && numUnionPlanes > 0 ) {
|
|
96
97
|
|
|
97
|
-
const clippingPlanes = uniformArray( unionPlanes );
|
|
98
|
+
const clippingPlanes = uniformArray( unionPlanes ).setGroup( renderGroup );
|
|
98
99
|
|
|
99
100
|
Loop( numUnionPlanes, ( { i } ) => {
|
|
100
101
|
|
|
@@ -113,7 +114,7 @@ class ClippingNode extends Node {
|
|
|
113
114
|
|
|
114
115
|
if ( numIntersectionPlanes > 0 ) {
|
|
115
116
|
|
|
116
|
-
const clippingPlanes = uniformArray( intersectionPlanes );
|
|
117
|
+
const clippingPlanes = uniformArray( intersectionPlanes ).setGroup( renderGroup );
|
|
117
118
|
const intersectionClipOpacity = float( 1 ).toVar( 'intersectionClipOpacity' );
|
|
118
119
|
|
|
119
120
|
Loop( numIntersectionPlanes, ( { i } ) => {
|
|
@@ -154,7 +155,7 @@ class ClippingNode extends Node {
|
|
|
154
155
|
|
|
155
156
|
if ( this.hardwareClipping === false && numUnionPlanes > 0 ) {
|
|
156
157
|
|
|
157
|
-
const clippingPlanes = uniformArray( unionPlanes );
|
|
158
|
+
const clippingPlanes = uniformArray( unionPlanes ).setGroup( renderGroup );
|
|
158
159
|
|
|
159
160
|
Loop( numUnionPlanes, ( { i } ) => {
|
|
160
161
|
|
|
@@ -169,7 +170,7 @@ class ClippingNode extends Node {
|
|
|
169
170
|
|
|
170
171
|
if ( numIntersectionPlanes > 0 ) {
|
|
171
172
|
|
|
172
|
-
const clippingPlanes = uniformArray( intersectionPlanes );
|
|
173
|
+
const clippingPlanes = uniformArray( intersectionPlanes ).setGroup( renderGroup );
|
|
173
174
|
const clipped = bool( true ).toVar( 'clipped' );
|
|
174
175
|
|
|
175
176
|
Loop( numIntersectionPlanes, ( { i } ) => {
|
|
@@ -202,7 +203,7 @@ class ClippingNode extends Node {
|
|
|
202
203
|
|
|
203
204
|
return Fn( () => {
|
|
204
205
|
|
|
205
|
-
const clippingPlanes = uniformArray( unionPlanes );
|
|
206
|
+
const clippingPlanes = uniformArray( unionPlanes ).setGroup( renderGroup );
|
|
206
207
|
const hw_clip_distances = builtin( builder.getClipDistance() );
|
|
207
208
|
|
|
208
209
|
Loop( numUnionPlanes, ( { i } ) => {
|
|
@@ -149,7 +149,7 @@ export const cubeTextureBase = /*@__PURE__*/ nodeProxy( CubeTextureNode ).setPar
|
|
|
149
149
|
*
|
|
150
150
|
* @tsl
|
|
151
151
|
* @function
|
|
152
|
-
* @param {?CubeTexture|CubeTextureNode} [value=EmptyTexture] - The cube texture.
|
|
152
|
+
* @param {?(CubeTexture|CubeTextureNode)} [value=EmptyTexture] - The cube texture.
|
|
153
153
|
* @param {?Node<vec3>} [uvNode=null] - The uv node.
|
|
154
154
|
* @param {?Node<int>} [levelNode=null] - The level node.
|
|
155
155
|
* @param {?Node<float>} [biasNode=null] - The bias node.
|
|
@@ -162,7 +162,7 @@ export const cubeTexture = ( value = EmptyTexture, uvNode = null, levelNode = nu
|
|
|
162
162
|
if ( value && value.isCubeTextureNode === true ) {
|
|
163
163
|
|
|
164
164
|
textureNode = nodeObject( value.clone() );
|
|
165
|
-
textureNode.referenceNode = value
|
|
165
|
+
textureNode.referenceNode = value; // Ensure the reference is set to the original node
|
|
166
166
|
|
|
167
167
|
if ( uvNode !== null ) textureNode.uvNode = nodeObject( uvNode );
|
|
168
168
|
if ( levelNode !== null ) textureNode.levelNode = nodeObject( levelNode );
|
|
@@ -109,7 +109,9 @@ class InstanceNode extends Node {
|
|
|
109
109
|
*/
|
|
110
110
|
setup( builder ) {
|
|
111
111
|
|
|
112
|
-
const {
|
|
112
|
+
const { instanceMatrix, instanceColor } = this;
|
|
113
|
+
|
|
114
|
+
const { count } = instanceMatrix;
|
|
113
115
|
|
|
114
116
|
let { instanceMatrixNode, instanceColorNode } = this;
|
|
115
117
|
|
|
@@ -6,7 +6,7 @@ import { positionView } from './Position.js';
|
|
|
6
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 { directionToFaceDirection } 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,7 +42,7 @@ 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>}
|
|
@@ -66,7 +66,7 @@ export const normalViewGeometry = /*@__PURE__*/ ( Fn( ( builder ) => {
|
|
|
66
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>}
|
|
@@ -86,7 +86,7 @@ export const normalWorldGeometry = /*@__PURE__*/ ( Fn( ( builder ) => {
|
|
|
86
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>}
|
|
@@ -118,7 +118,7 @@ export const normalView = /*@__PURE__*/ ( Fn( ( { subBuildFn, material, context
|
|
|
118
118
|
}, 'vec3' ).once( [ 'NORMAL', 'VERTEX' ] ) )().toVar( 'normalView' );
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
|
-
* TSL object that represents the
|
|
121
|
+
* TSL object that represents the vertex normal of the current rendered object in world space.
|
|
122
122
|
*
|
|
123
123
|
* @tsl
|
|
124
124
|
* @type {Node<vec3>}
|
|
@@ -126,7 +126,7 @@ export const normalView = /*@__PURE__*/ ( Fn( ( { subBuildFn, material, context
|
|
|
126
126
|
export const normalWorld = /*@__PURE__*/ normalView.transformDirection( cameraViewMatrix ).toVar( 'normalWorld' );
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
|
-
* TSL object that represents the
|
|
129
|
+
* TSL object that represents the clearcoat vertex normal of the current rendered object in view space.
|
|
130
130
|
*
|
|
131
131
|
* @tsl
|
|
132
132
|
* @type {Node<vec3>}
|
|
@@ -200,7 +200,7 @@ export const transformNormalToView = /*@__PURE__*/ Fn( ( [ normal ], builder ) =
|
|
|
200
200
|
// Deprecated
|
|
201
201
|
|
|
202
202
|
/**
|
|
203
|
-
* TSL object that represents the transformed vertex normal
|
|
203
|
+
* TSL object that represents the transformed vertex normal of the current rendered object in view space.
|
|
204
204
|
*
|
|
205
205
|
* @tsl
|
|
206
206
|
* @type {Node<vec3>}
|
|
@@ -214,7 +214,7 @@ export const transformedNormalView = ( Fn( () => { // @deprecated, r177
|
|
|
214
214
|
} ).once( [ 'NORMAL', 'VERTEX' ] ) )();
|
|
215
215
|
|
|
216
216
|
/**
|
|
217
|
-
* TSL object that represents the transformed vertex normal
|
|
217
|
+
* TSL object that represents the transformed vertex normal of the current rendered object in world space.
|
|
218
218
|
*
|
|
219
219
|
* @tsl
|
|
220
220
|
* @type {Node<vec3>}
|
|
@@ -228,7 +228,7 @@ export const transformedNormalWorld = ( Fn( () => { // @deprecated, r177
|
|
|
228
228
|
} ).once( [ 'NORMAL', 'VERTEX' ] ) )();
|
|
229
229
|
|
|
230
230
|
/**
|
|
231
|
-
* TSL object that represents the transformed clearcoat vertex normal
|
|
231
|
+
* TSL object that represents the transformed clearcoat vertex normal of the current rendered object in view space.
|
|
232
232
|
*
|
|
233
233
|
* @tsl
|
|
234
234
|
* @type {Node<vec3>}
|
|
@@ -216,12 +216,12 @@ class ReferenceNode extends Node {
|
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
/**
|
|
219
|
-
* Sets the
|
|
219
|
+
* Sets the name for the internal uniform.
|
|
220
220
|
*
|
|
221
221
|
* @param {string} name - The label to set.
|
|
222
222
|
* @return {ReferenceNode} A reference to this node.
|
|
223
223
|
*/
|
|
224
|
-
|
|
224
|
+
setName( name ) {
|
|
225
225
|
|
|
226
226
|
this.name = name;
|
|
227
227
|
|
|
@@ -229,6 +229,21 @@ class ReferenceNode extends Node {
|
|
|
229
229
|
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
+
/**
|
|
233
|
+
* Sets the label for the internal uniform.
|
|
234
|
+
*
|
|
235
|
+
* @deprecated
|
|
236
|
+
* @param {string} name - The label to set.
|
|
237
|
+
* @return {ReferenceNode} A reference to this node.
|
|
238
|
+
*/
|
|
239
|
+
label( name ) {
|
|
240
|
+
|
|
241
|
+
console.warn( 'THREE.TSL: "label()" has been deprecated. Use "setName()" instead.' ); // @deprecated r179
|
|
242
|
+
|
|
243
|
+
return this.setName( name );
|
|
244
|
+
|
|
245
|
+
}
|
|
246
|
+
|
|
232
247
|
/**
|
|
233
248
|
* Sets the node type which automatically defines the internal
|
|
234
249
|
* uniform type.
|
|
@@ -267,9 +282,9 @@ class ReferenceNode extends Node {
|
|
|
267
282
|
|
|
268
283
|
}
|
|
269
284
|
|
|
270
|
-
if ( this.name !== null ) node.
|
|
285
|
+
if ( this.name !== null ) node.setName( this.name );
|
|
271
286
|
|
|
272
|
-
this.node = node
|
|
287
|
+
this.node = node;
|
|
273
288
|
|
|
274
289
|
}
|
|
275
290
|
|