super-three 0.168.0 → 0.169.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +369 -131
- package/build/three.module.js +369 -131
- package/build/three.module.min.js +1 -1
- package/build/three.webgpu.js +24644 -22406
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +79941 -0
- package/build/three.webgpu.nodes.min.js +6 -0
- package/examples/jsm/Addons.js +0 -6
- package/examples/jsm/controls/TrackballControls.js +32 -12
- package/examples/jsm/controls/TransformControls.js +97 -62
- package/examples/jsm/exporters/DRACOExporter.js +4 -2
- package/examples/jsm/exporters/EXRExporter.js +19 -11
- package/examples/jsm/exporters/KTX2Exporter.js +21 -13
- package/examples/jsm/exporters/OBJExporter.js +5 -1
- package/examples/jsm/exporters/PLYExporter.js +9 -7
- package/examples/jsm/geometries/DecalGeometry.js +4 -1
- package/examples/jsm/geometries/InstancedPointsGeometry.js +1 -1
- package/examples/jsm/helpers/LightProbeHelper.js +1 -1
- package/examples/jsm/helpers/LightProbeHelperGPU.js +65 -0
- package/examples/jsm/libs/basis/basis_transcoder.js +8 -10
- package/examples/jsm/libs/basis/basis_transcoder.wasm +0 -0
- package/examples/jsm/libs/ktx-parse.module.js +1 -1
- package/examples/jsm/lights/LightProbeGenerator.js +24 -10
- package/examples/jsm/loaders/ColladaLoader.js +9 -6
- package/examples/jsm/loaders/DRACOLoader.js +3 -1
- package/examples/jsm/loaders/FBXLoader.js +30 -20
- package/examples/jsm/loaders/GLTFLoader.js +5 -10
- package/examples/jsm/loaders/KTX2Loader.js +10 -7
- package/examples/jsm/loaders/MTLLoader.js +4 -3
- package/examples/jsm/loaders/MaterialXLoader.js +29 -10
- package/examples/jsm/loaders/OBJLoader.js +5 -3
- package/examples/jsm/loaders/PCDLoader.js +5 -4
- package/examples/jsm/loaders/PDBLoader.js +3 -2
- package/examples/jsm/loaders/PLYLoader.js +8 -5
- package/examples/jsm/loaders/STLLoader.js +3 -2
- package/examples/jsm/loaders/VRMLLoader.js +10 -10
- package/examples/jsm/loaders/VTKLoader.js +4 -3
- package/examples/jsm/loaders/XYZLoader.js +3 -2
- package/examples/jsm/misc/Timer.js +1 -1
- package/examples/jsm/modifiers/CurveModifierGPU.js +233 -0
- package/examples/jsm/objects/LensflareMesh.js +322 -0
- package/examples/jsm/objects/SkyMesh.js +1 -2
- package/examples/jsm/objects/Water2Mesh.js +2 -3
- package/examples/jsm/objects/WaterMesh.js +1 -2
- package/examples/jsm/physics/JoltPhysics.js +1 -1
- package/examples/jsm/physics/RapierPhysics.js +1 -1
- package/examples/jsm/transpiler/GLSLDecoder.js +1 -1
- package/examples/jsm/transpiler/ShaderToyDecoder.js +2 -2
- package/examples/jsm/utils/GeometryCompressionUtils.js +37 -122
- package/examples/jsm/utils/ShadowMapViewer.js +3 -8
- package/examples/jsm/utils/ShadowMapViewerGPU.js +201 -0
- package/examples/jsm/utils/SkeletonUtils.js +84 -66
- package/examples/jsm/utils/TextureUtils.js +1 -0
- package/examples/jsm/utils/TextureUtilsGPU.js +63 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +1 -1
- package/package.json +2 -2
- package/src/Three.WebGPU.Nodes.js +200 -0
- package/src/Three.WebGPU.js +2 -1
- package/src/audio/Audio.js +2 -2
- package/src/constants.js +1 -1
- package/src/core/BufferAttribute.js +0 -9
- package/src/core/Clock.js +1 -1
- package/src/core/InterleavedBuffer.js +0 -9
- package/src/extras/Controls.js +1 -1
- package/src/geometries/CylinderGeometry.js +11 -4
- package/src/loaders/MaterialLoader.js +7 -1
- package/src/loaders/nodes/NodeLoader.js +24 -4
- package/src/loaders/nodes/NodeMaterialLoader.js +21 -17
- package/src/loaders/nodes/NodeObjectLoader.js +19 -0
- package/src/materials/nodes/InstancedPointsNodeMaterial.js +19 -34
- package/src/materials/nodes/Line2NodeMaterial.js +26 -26
- package/src/materials/nodes/LineBasicNodeMaterial.js +7 -3
- package/src/materials/nodes/LineDashedNodeMaterial.js +7 -3
- package/src/materials/nodes/MeshBasicNodeMaterial.js +7 -3
- package/src/materials/nodes/MeshLambertNodeMaterial.js +7 -3
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +7 -3
- package/src/materials/nodes/MeshNormalNodeMaterial.js +7 -3
- package/src/materials/nodes/MeshPhongNodeMaterial.js +7 -3
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +6 -3
- package/src/materials/nodes/MeshSSSNodeMaterial.js +6 -3
- package/src/materials/nodes/MeshStandardNodeMaterial.js +7 -3
- package/src/materials/nodes/MeshToonNodeMaterial.js +7 -3
- package/src/materials/nodes/NodeMaterial.js +20 -45
- package/src/materials/nodes/NodeMaterials.js +2 -0
- package/src/materials/nodes/PointsNodeMaterial.js +7 -3
- package/src/materials/nodes/ShadowNodeMaterial.js +7 -3
- package/src/materials/nodes/SpriteNodeMaterial.js +39 -6
- package/src/materials/nodes/VolumeNodeMaterial.js +13 -9
- package/src/materials/nodes/manager/NodeMaterialObserver.js +302 -0
- package/src/math/Triangle.js +24 -0
- package/src/nodes/Nodes.js +3 -3
- package/src/nodes/TSL.js +96 -93
- package/src/nodes/accessors/BatchNode.js +7 -3
- package/src/nodes/accessors/BufferAttributeNode.js +6 -3
- package/src/nodes/accessors/BufferNode.js +6 -3
- package/src/nodes/accessors/Camera.js +10 -16
- package/src/nodes/accessors/ClippingNode.js +7 -3
- package/src/nodes/accessors/CubeTextureNode.js +6 -3
- package/src/nodes/accessors/InstanceNode.js +11 -11
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +6 -3
- package/src/nodes/accessors/Lights.js +51 -0
- package/src/nodes/accessors/MaterialNode.js +8 -4
- package/src/nodes/accessors/MaterialReferenceNode.js +6 -3
- package/src/nodes/accessors/ModelNode.js +42 -7
- package/src/nodes/accessors/ModelViewProjectionNode.js +9 -5
- package/src/nodes/accessors/MorphNode.js +7 -3
- package/src/nodes/accessors/Normal.js +32 -6
- package/src/nodes/accessors/Object3DNode.js +11 -27
- package/src/nodes/accessors/PointUVNode.js +7 -3
- package/src/nodes/accessors/ReferenceBaseNode.js +32 -4
- package/src/nodes/accessors/ReferenceNode.js +40 -3
- package/src/nodes/accessors/RendererReferenceNode.js +9 -3
- package/src/nodes/accessors/SceneNode.js +7 -3
- package/src/nodes/accessors/SkinningNode.js +7 -3
- package/src/nodes/accessors/StorageBufferNode.js +21 -3
- package/src/nodes/accessors/StorageTextureNode.js +7 -4
- package/src/nodes/accessors/Texture3DNode.js +7 -4
- package/src/nodes/accessors/TextureNode.js +19 -8
- package/src/nodes/accessors/TextureSizeNode.js +8 -5
- package/src/nodes/accessors/UniformArrayNode.js +12 -9
- package/src/nodes/accessors/UserDataNode.js +9 -6
- package/src/nodes/accessors/VelocityNode.js +74 -23
- package/src/nodes/accessors/VertexColorNode.js +6 -3
- package/src/nodes/code/CodeNode.js +7 -3
- package/src/nodes/code/ExpressionNode.js +8 -4
- package/src/nodes/code/FunctionCallNode.js +6 -3
- package/src/nodes/code/FunctionNode.js +6 -3
- package/src/nodes/code/ScriptableNode.js +11 -6
- package/src/nodes/code/ScriptableValueNode.js +7 -3
- package/src/nodes/core/AssignNode.js +9 -6
- package/src/nodes/core/AttributeNode.js +7 -3
- package/src/nodes/core/BypassNode.js +8 -4
- package/src/nodes/core/CacheNode.js +8 -4
- package/src/nodes/core/ConstNode.js +6 -3
- package/src/nodes/core/ContextNode.js +7 -3
- package/src/nodes/core/IndexNode.js +25 -3
- package/src/nodes/core/InputNode.js +7 -3
- package/src/nodes/core/MRTNode.js +6 -3
- package/src/nodes/core/Node.js +10 -51
- package/src/nodes/core/NodeBuilder.js +71 -5
- package/src/nodes/core/NodeUtils.js +48 -6
- package/src/nodes/core/OutputStructNode.js +8 -4
- package/src/nodes/core/ParameterNode.js +6 -3
- package/src/nodes/core/PropertyNode.js +7 -3
- package/src/nodes/core/StackNode.js +7 -3
- package/src/nodes/core/StructTypeNode.js +7 -3
- package/src/nodes/core/TempNode.js +8 -4
- package/src/nodes/core/UniformGroupNode.js +10 -6
- package/src/nodes/core/UniformNode.js +6 -3
- package/src/nodes/core/VarNode.js +8 -4
- package/src/nodes/core/VaryingNode.js +7 -3
- package/src/nodes/display/AfterImageNode.js +6 -0
- package/src/nodes/display/AnaglyphPassNode.js +6 -0
- package/src/nodes/display/AnamorphicNode.js +6 -0
- package/src/nodes/display/BloomNode.js +6 -0
- package/src/nodes/display/BumpMapNode.js +6 -0
- package/src/nodes/display/ColorSpaceFunctions.js +4 -4
- package/src/nodes/display/ColorSpaceNode.js +43 -14
- package/src/nodes/display/DenoiseNode.js +6 -3
- package/src/nodes/display/DepthOfFieldNode.js +6 -3
- package/src/nodes/display/DotScreenNode.js +8 -5
- package/src/nodes/display/FXAANode.js +6 -3
- package/src/nodes/display/FilmNode.js +6 -3
- package/src/nodes/display/FrontFacingNode.js +7 -3
- package/src/nodes/display/GTAONode.js +6 -3
- package/src/nodes/display/GaussianBlurNode.js +6 -3
- package/src/nodes/display/Lut3DNode.js +6 -3
- package/src/nodes/display/NormalMapNode.js +8 -6
- package/src/nodes/display/ParallaxBarrierPassNode.js +8 -5
- package/src/nodes/display/PassNode.js +18 -7
- package/src/nodes/display/PixelationPassNode.js +12 -5
- package/src/nodes/display/PosterizeNode.js +6 -3
- package/src/nodes/display/RGBShiftNode.js +6 -3
- package/src/nodes/display/RenderOutputNode.js +12 -8
- package/src/nodes/display/SSAAPassNode.js +6 -3
- package/src/nodes/display/ScreenNode.js +181 -0
- package/src/nodes/display/SobelOperatorNode.js +6 -3
- package/src/nodes/display/StereoCompositePassNode.js +6 -3
- package/src/nodes/display/StereoPassNode.js +6 -3
- package/src/nodes/display/ToneMappingFunctions.js +12 -12
- package/src/nodes/display/ToneMappingNode.js +8 -7
- package/src/nodes/display/ToonOutlinePassNode.js +111 -0
- package/src/nodes/display/TransitionNode.js +6 -3
- package/src/nodes/display/ViewportDepthNode.js +7 -3
- package/src/nodes/display/ViewportDepthTextureNode.js +8 -5
- package/src/nodes/display/ViewportSharedTextureNode.js +8 -5
- package/src/nodes/display/ViewportTextureNode.js +8 -5
- package/src/nodes/fog/FogExp2Node.js +6 -3
- package/src/nodes/fog/FogNode.js +7 -3
- package/src/nodes/fog/FogRangeNode.js +6 -3
- package/src/nodes/functions/PhysicalLightingModel.js +2 -2
- package/src/nodes/functions/material/getShIrradianceAt.js +28 -0
- package/src/nodes/geometry/RangeNode.js +7 -3
- package/src/nodes/gpgpu/AtomicFunctionNode.js +99 -0
- package/src/nodes/gpgpu/BarrierNode.js +40 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +98 -0
- package/src/nodes/gpgpu/ComputeNode.js +8 -4
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +100 -0
- package/src/nodes/lighting/AONode.js +6 -3
- package/src/nodes/lighting/AmbientLightNode.js +6 -3
- package/src/nodes/lighting/AnalyticLightNode.js +198 -30
- package/src/nodes/lighting/BasicEnvironmentNode.js +6 -3
- package/src/nodes/lighting/BasicLightMapNode.js +6 -3
- package/src/nodes/lighting/DirectionalLightNode.js +7 -4
- package/src/nodes/lighting/EnvironmentNode.js +6 -3
- package/src/nodes/lighting/HemisphereLightNode.js +10 -6
- package/src/nodes/lighting/IESSpotLightNode.js +6 -3
- package/src/nodes/lighting/IrradianceNode.js +6 -3
- package/src/nodes/lighting/LightProbeNode.js +8 -31
- package/src/nodes/lighting/LightingContextNode.js +6 -3
- package/src/nodes/lighting/LightingNode.js +7 -3
- package/src/nodes/lighting/LightsNode.js +24 -5
- package/src/nodes/lighting/PointLightNode.js +11 -7
- package/src/nodes/lighting/RectAreaLightNode.js +11 -7
- package/src/nodes/lighting/SpotLightNode.js +13 -10
- package/src/nodes/math/ConditionalNode.js +23 -6
- package/src/nodes/math/MathNode.js +6 -3
- package/src/nodes/math/OperatorNode.js +6 -3
- package/src/nodes/pmrem/PMREMNode.js +6 -3
- package/src/nodes/utils/ArrayElementNode.js +8 -4
- package/src/nodes/utils/ConvertNode.js +7 -3
- package/src/nodes/utils/CubeMapNode.js +6 -3
- package/src/nodes/utils/EquirectUVNode.js +6 -3
- package/src/nodes/utils/FlipNode.js +7 -4
- package/src/nodes/utils/FunctionOverloadingNode.js +7 -3
- package/src/nodes/utils/JoinNode.js +6 -3
- package/src/nodes/utils/LoopNode.js +7 -3
- package/src/nodes/utils/MatcapUVNode.js +6 -3
- package/src/nodes/utils/MaxMipLevelNode.js +6 -3
- package/src/nodes/utils/OscNode.js +7 -3
- package/src/nodes/utils/RTTNode.js +6 -3
- package/src/nodes/utils/ReflectorNode.js +8 -5
- package/src/nodes/utils/RemapNode.js +7 -3
- package/src/nodes/utils/RotateNode.js +6 -3
- package/src/nodes/utils/SetNode.js +7 -4
- package/src/nodes/utils/SplitNode.js +7 -3
- package/src/nodes/utils/SpriteSheetUVNode.js +7 -3
- package/src/nodes/utils/StorageArrayElementNode.js +9 -8
- package/src/nodes/utils/TimerNode.js +6 -3
- package/src/nodes/utils/TriplanarTexturesNode.js +7 -3
- package/src/nodes/utils/ViewportUtils.js +2 -2
- package/src/objects/BatchedMesh.js +76 -10
- package/src/objects/LOD.js +21 -0
- package/src/objects/Line.js +1 -0
- package/src/objects/Mesh.js +7 -23
- package/src/objects/Points.js +2 -0
- package/src/renderers/WebGLRenderer.js +64 -41
- package/src/renderers/common/BundleGroup.js +26 -0
- package/src/renderers/common/ClippingContext.js +4 -3
- package/src/renderers/common/RenderContext.js +4 -5
- package/src/renderers/common/RenderObject.js +116 -5
- package/src/renderers/common/RenderObjects.js +8 -1
- package/src/renderers/common/Renderer.js +57 -49
- package/src/renderers/common/extras/PMREMGenerator.js +7 -9
- package/src/renderers/common/nodes/NodeBuilderState.js +3 -3
- package/src/renderers/common/nodes/Nodes.js +33 -14
- package/src/renderers/shaders/ShaderLib/sprite.glsl.js +2 -4
- package/src/renderers/webgl/WebGLAttributes.js +45 -14
- package/src/renderers/webgl/WebGLCapabilities.js +9 -0
- package/src/renderers/webgl/WebGLProgram.js +2 -0
- package/src/renderers/webgl/WebGLPrograms.js +21 -17
- package/src/renderers/webgl/WebGLState.js +21 -0
- package/src/renderers/webgl/WebGLTextures.js +22 -0
- package/src/renderers/webgl-fallback/WebGLBackend.js +50 -45
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +4 -4
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +6 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +1 -4
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +61 -16
- package/src/renderers/webgpu/WebGPUBackend.js +33 -25
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +42 -0
- package/src/renderers/webgpu/WebGPURenderer.js +5 -2
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +59 -0
- package/src/renderers/{common → webgpu}/nodes/StandardNodeLibrary.js +11 -11
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +91 -11
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +6 -16
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +1 -1
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +7 -5
- package/src/renderers/webgpu/utils/WebGPUUtils.js +1 -1
- package/src/utils.js +33 -1
- package/examples/jsm/geometries/SDFGeometryGenerator.js +0 -144
- package/examples/jsm/loaders/TiltLoader.js +0 -520
- package/examples/jsm/utils/GPUStatsPanel.js +0 -95
- package/examples/jsm/utils/PackedPhongMaterial.js +0 -178
- package/src/nodes/display/ViewportNode.js +0 -138
- package/src/nodes/lighting/LightNode.js +0 -57
- package/src/renderers/common/StandardRenderer.js +0 -18
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import Node from '../core/Node.js';
|
|
2
|
+
import { NodeUpdateType } from '../core/constants.js';
|
|
3
|
+
import { uniform } from '../core/UniformNode.js';
|
|
4
|
+
import { Fn, nodeImmutable, vec2 } from '../tsl/TSLBase.js';
|
|
5
|
+
|
|
6
|
+
import { Vector2 } from '../../math/Vector2.js';
|
|
7
|
+
import { Vector4 } from '../../math/Vector4.js';
|
|
8
|
+
|
|
9
|
+
let screenSizeVec, viewportVec;
|
|
10
|
+
|
|
11
|
+
class ScreenNode extends Node {
|
|
12
|
+
|
|
13
|
+
static get type() {
|
|
14
|
+
|
|
15
|
+
return 'ScreenNode';
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
constructor( scope ) {
|
|
20
|
+
|
|
21
|
+
super();
|
|
22
|
+
|
|
23
|
+
this.scope = scope;
|
|
24
|
+
|
|
25
|
+
this.isViewportNode = true;
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
getNodeType() {
|
|
30
|
+
|
|
31
|
+
if ( this.scope === ScreenNode.VIEWPORT ) return 'vec4';
|
|
32
|
+
else return 'vec2';
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
getUpdateType() {
|
|
37
|
+
|
|
38
|
+
let updateType = NodeUpdateType.NONE;
|
|
39
|
+
|
|
40
|
+
if ( this.scope === ScreenNode.SIZE || this.scope === ScreenNode.VIEWPORT ) {
|
|
41
|
+
|
|
42
|
+
updateType = NodeUpdateType.RENDER;
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
this.updateType = updateType;
|
|
47
|
+
|
|
48
|
+
return updateType;
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
update( { renderer } ) {
|
|
53
|
+
|
|
54
|
+
const renderTarget = renderer.getRenderTarget();
|
|
55
|
+
|
|
56
|
+
if ( this.scope === ScreenNode.VIEWPORT ) {
|
|
57
|
+
|
|
58
|
+
if ( renderTarget !== null ) {
|
|
59
|
+
|
|
60
|
+
viewportVec.copy( renderTarget.viewport );
|
|
61
|
+
|
|
62
|
+
} else {
|
|
63
|
+
|
|
64
|
+
renderer.getViewport( viewportVec );
|
|
65
|
+
|
|
66
|
+
viewportVec.multiplyScalar( renderer.getPixelRatio() );
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
} else {
|
|
71
|
+
|
|
72
|
+
if ( renderTarget !== null ) {
|
|
73
|
+
|
|
74
|
+
screenSizeVec.width = renderTarget.width;
|
|
75
|
+
screenSizeVec.height = renderTarget.height;
|
|
76
|
+
|
|
77
|
+
} else {
|
|
78
|
+
|
|
79
|
+
renderer.getDrawingBufferSize( screenSizeVec );
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
setup( /*builder*/ ) {
|
|
88
|
+
|
|
89
|
+
const scope = this.scope;
|
|
90
|
+
|
|
91
|
+
let output = null;
|
|
92
|
+
|
|
93
|
+
if ( scope === ScreenNode.SIZE ) {
|
|
94
|
+
|
|
95
|
+
output = uniform( screenSizeVec || ( screenSizeVec = new Vector2() ) );
|
|
96
|
+
|
|
97
|
+
} else if ( scope === ScreenNode.VIEWPORT ) {
|
|
98
|
+
|
|
99
|
+
output = uniform( viewportVec || ( viewportVec = new Vector4() ) );
|
|
100
|
+
|
|
101
|
+
} else {
|
|
102
|
+
|
|
103
|
+
output = vec2( screenCoordinate.div( screenSize ) );
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return output;
|
|
108
|
+
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
generate( builder ) {
|
|
112
|
+
|
|
113
|
+
if ( this.scope === ScreenNode.COORDINATE ) {
|
|
114
|
+
|
|
115
|
+
let coord = builder.getFragCoord();
|
|
116
|
+
|
|
117
|
+
if ( builder.isFlipY() ) {
|
|
118
|
+
|
|
119
|
+
// follow webgpu standards
|
|
120
|
+
|
|
121
|
+
const size = builder.getNodeProperties( screenSize ).outputNode.build( builder );
|
|
122
|
+
|
|
123
|
+
coord = `${ builder.getType( 'vec2' ) }( ${ coord }.x, ${ size }.y - ${ coord }.y )`;
|
|
124
|
+
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return coord;
|
|
128
|
+
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return super.generate( builder );
|
|
132
|
+
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
ScreenNode.COORDINATE = 'coordinate';
|
|
138
|
+
ScreenNode.VIEWPORT = 'viewport';
|
|
139
|
+
ScreenNode.SIZE = 'size';
|
|
140
|
+
ScreenNode.UV = 'uv';
|
|
141
|
+
|
|
142
|
+
export default ScreenNode;
|
|
143
|
+
|
|
144
|
+
// Screen
|
|
145
|
+
|
|
146
|
+
export const screenUV = /*@__PURE__*/ nodeImmutable( ScreenNode, ScreenNode.UV );
|
|
147
|
+
export const screenSize = /*@__PURE__*/ nodeImmutable( ScreenNode, ScreenNode.SIZE );
|
|
148
|
+
export const screenCoordinate = /*@__PURE__*/ nodeImmutable( ScreenNode, ScreenNode.COORDINATE );
|
|
149
|
+
|
|
150
|
+
// Viewport
|
|
151
|
+
|
|
152
|
+
export const viewport = /*@__PURE__*/ nodeImmutable( ScreenNode, ScreenNode.VIEWPORT );
|
|
153
|
+
export const viewportSize = viewport.zw;
|
|
154
|
+
export const viewportCoordinate = /*@__PURE__*/ screenCoordinate.sub( viewport.xy );
|
|
155
|
+
export const viewportUV = /*@__PURE__*/ viewportCoordinate.div( viewportSize );
|
|
156
|
+
|
|
157
|
+
// Deprecated
|
|
158
|
+
|
|
159
|
+
export const viewportResolution = /*@__PURE__*/ ( Fn( () => { // @deprecated, r169
|
|
160
|
+
|
|
161
|
+
console.warn( 'TSL.ViewportNode: "viewportResolution" is deprecated. Use "screenSize" instead.' );
|
|
162
|
+
|
|
163
|
+
return screenSize;
|
|
164
|
+
|
|
165
|
+
}, 'vec2' ).once() )();
|
|
166
|
+
|
|
167
|
+
export const viewportTopLeft = /*@__PURE__*/ ( Fn( () => { // @deprecated, r168
|
|
168
|
+
|
|
169
|
+
console.warn( 'TSL.ViewportNode: "viewportTopLeft" is deprecated. Use "screenUV" instead.' );
|
|
170
|
+
|
|
171
|
+
return screenUV;
|
|
172
|
+
|
|
173
|
+
}, 'vec2' ).once() )();
|
|
174
|
+
|
|
175
|
+
export const viewportBottomLeft = /*@__PURE__*/ ( Fn( () => { // @deprecated, r168
|
|
176
|
+
|
|
177
|
+
console.warn( 'TSL.ViewportNode: "viewportBottomLeft" is deprecated. Use "screenUV.flipY()" instead.' );
|
|
178
|
+
|
|
179
|
+
return screenUV.flipY();
|
|
180
|
+
|
|
181
|
+
}, 'vec2' ).once() )();
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { registerNode } from '../core/Node.js';
|
|
2
1
|
import TempNode from '../core/TempNode.js';
|
|
3
2
|
import { uv } from '../accessors/UV.js';
|
|
4
3
|
import { luminance } from './ColorAdjustment.js';
|
|
@@ -12,6 +11,12 @@ import { Vector2 } from '../../math/Vector2.js';
|
|
|
12
11
|
|
|
13
12
|
class SobelOperatorNode extends TempNode {
|
|
14
13
|
|
|
14
|
+
static get type() {
|
|
15
|
+
|
|
16
|
+
return 'SobelOperatorNode';
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
15
20
|
constructor( textureNode ) {
|
|
16
21
|
|
|
17
22
|
super();
|
|
@@ -118,6 +123,4 @@ class SobelOperatorNode extends TempNode {
|
|
|
118
123
|
|
|
119
124
|
export default SobelOperatorNode;
|
|
120
125
|
|
|
121
|
-
SobelOperatorNode.type = /*@__PURE__*/ registerNode( 'SobelOperator', SobelOperatorNode );
|
|
122
|
-
|
|
123
126
|
export const sobel = ( node ) => nodeObject( new SobelOperatorNode( convertToTexture( node ) ) );
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
import { registerNode } from '../core/Node.js';
|
|
3
2
|
import PassNode from './PassNode.js';
|
|
4
3
|
import { StereoCamera } from '../../cameras/StereoCamera.js';
|
|
5
4
|
import { HalfFloatType, LinearFilter, NearestFilter } from '../../constants.js';
|
|
@@ -13,6 +12,12 @@ const _quadMesh = /*@__PURE__*/ new QuadMesh();
|
|
|
13
12
|
|
|
14
13
|
class StereoCompositePassNode extends PassNode {
|
|
15
14
|
|
|
15
|
+
static get type() {
|
|
16
|
+
|
|
17
|
+
return 'StereoCompositePassNode';
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
|
|
16
21
|
constructor( scene, camera ) {
|
|
17
22
|
|
|
18
23
|
super( PassNode.COLOR, scene, camera );
|
|
@@ -103,5 +108,3 @@ class StereoCompositePassNode extends PassNode {
|
|
|
103
108
|
}
|
|
104
109
|
|
|
105
110
|
export default StereoCompositePassNode;
|
|
106
|
-
|
|
107
|
-
StereoCompositePassNode.type = /*@__PURE__*/ registerNode( 'StereoCompositePass', StereoCompositePassNode );
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { registerNode } from '../core/Node.js';
|
|
2
1
|
import { nodeObject } from '../tsl/TSLBase.js';
|
|
3
2
|
import PassNode from './PassNode.js';
|
|
4
3
|
import { Vector2 } from '../../math/Vector2.js';
|
|
@@ -8,6 +7,12 @@ const _size = /*@__PURE__*/ new Vector2();
|
|
|
8
7
|
|
|
9
8
|
class StereoPassNode extends PassNode {
|
|
10
9
|
|
|
10
|
+
static get type() {
|
|
11
|
+
|
|
12
|
+
return 'StereoPassNode';
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
|
|
11
16
|
constructor( scene, camera ) {
|
|
12
17
|
|
|
13
18
|
super( PassNode.COLOR, scene, camera );
|
|
@@ -75,6 +80,4 @@ class StereoPassNode extends PassNode {
|
|
|
75
80
|
|
|
76
81
|
export default StereoPassNode;
|
|
77
82
|
|
|
78
|
-
StereoPassNode.type = /*@__PURE__*/ registerNode( 'StereoPass', StereoPassNode );
|
|
79
|
-
|
|
80
83
|
export const stereoPass = ( scene, camera ) => nodeObject( new StereoPassNode( scene, camera ) );
|
|
@@ -5,12 +5,12 @@ import { mul, sub, div } from '../math/OperatorNode.js';
|
|
|
5
5
|
|
|
6
6
|
// exposure only
|
|
7
7
|
|
|
8
|
-
export const
|
|
8
|
+
export const linearToneMapping = /*@__PURE__*/ Fn( ( [ color, exposure ] ) => {
|
|
9
9
|
|
|
10
10
|
return color.mul( exposure ).clamp();
|
|
11
11
|
|
|
12
12
|
} ).setLayout( {
|
|
13
|
-
name: '
|
|
13
|
+
name: 'linearToneMapping',
|
|
14
14
|
type: 'vec3',
|
|
15
15
|
inputs: [
|
|
16
16
|
{ name: 'color', type: 'vec3' },
|
|
@@ -20,14 +20,14 @@ export const LinearToneMapping = /*@__PURE__*/ Fn( ( [ color, exposure ] ) => {
|
|
|
20
20
|
|
|
21
21
|
// source: https://www.cs.utah.edu/docs/techreports/2002/pdf/UUCS-02-001.pdf
|
|
22
22
|
|
|
23
|
-
export const
|
|
23
|
+
export const reinhardToneMapping = /*@__PURE__*/ Fn( ( [ color, exposure ] ) => {
|
|
24
24
|
|
|
25
25
|
color = color.mul( exposure );
|
|
26
26
|
|
|
27
27
|
return color.div( color.add( 1.0 ) ).clamp();
|
|
28
28
|
|
|
29
29
|
} ).setLayout( {
|
|
30
|
-
name: '
|
|
30
|
+
name: 'reinhardToneMapping',
|
|
31
31
|
type: 'vec3',
|
|
32
32
|
inputs: [
|
|
33
33
|
{ name: 'color', type: 'vec3' },
|
|
@@ -37,7 +37,7 @@ export const ReinhardToneMapping = /*@__PURE__*/ Fn( ( [ color, exposure ] ) =>
|
|
|
37
37
|
|
|
38
38
|
// source: http://filmicworlds.com/blog/filmic-tonemapping-operators/
|
|
39
39
|
|
|
40
|
-
export const
|
|
40
|
+
export const cineonToneMapping = /*@__PURE__*/ Fn( ( [ color, exposure ] ) => {
|
|
41
41
|
|
|
42
42
|
// filmic operator by Jim Hejl and Richard Burgess-Dawson
|
|
43
43
|
color = color.mul( exposure );
|
|
@@ -49,7 +49,7 @@ export const CineonToneMapping = /*@__PURE__*/ Fn( ( [ color, exposure ] ) => {
|
|
|
49
49
|
return a.div( b ).pow( 2.2 );
|
|
50
50
|
|
|
51
51
|
} ).setLayout( {
|
|
52
|
-
name: '
|
|
52
|
+
name: 'cineonToneMapping',
|
|
53
53
|
type: 'vec3',
|
|
54
54
|
inputs: [
|
|
55
55
|
{ name: 'color', type: 'vec3' },
|
|
@@ -70,7 +70,7 @@ const RRTAndODTFit = /*@__PURE__*/ Fn( ( [ color ] ) => {
|
|
|
70
70
|
|
|
71
71
|
// source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs
|
|
72
72
|
|
|
73
|
-
export const
|
|
73
|
+
export const acesFilmicToneMapping = /*@__PURE__*/ Fn( ( [ color, exposure ] ) => {
|
|
74
74
|
|
|
75
75
|
// sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT
|
|
76
76
|
const ACESInputMat = mat3(
|
|
@@ -99,7 +99,7 @@ export const ACESFilmicToneMapping = /*@__PURE__*/ Fn( ( [ color, exposure ] ) =
|
|
|
99
99
|
return color.clamp();
|
|
100
100
|
|
|
101
101
|
} ).setLayout( {
|
|
102
|
-
name: '
|
|
102
|
+
name: 'acesFilmicToneMapping',
|
|
103
103
|
type: 'vec3',
|
|
104
104
|
inputs: [
|
|
105
105
|
{ name: 'color', type: 'vec3' },
|
|
@@ -120,7 +120,7 @@ const agxDefaultContrastApprox = /*@__PURE__*/ Fn( ( [ x_immutable ] ) => {
|
|
|
120
120
|
|
|
121
121
|
} );
|
|
122
122
|
|
|
123
|
-
export const
|
|
123
|
+
export const agxToneMapping = /*@__PURE__*/ Fn( ( [ color, exposure ] ) => {
|
|
124
124
|
|
|
125
125
|
const colortone = vec3( color ).toVar();
|
|
126
126
|
const AgXInsetMatrix = mat3( vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) );
|
|
@@ -143,7 +143,7 @@ export const AgXToneMapping = /*@__PURE__*/ Fn( ( [ color, exposure ] ) => {
|
|
|
143
143
|
return colortone;
|
|
144
144
|
|
|
145
145
|
} ).setLayout( {
|
|
146
|
-
name: '
|
|
146
|
+
name: 'agxToneMapping',
|
|
147
147
|
type: 'vec3',
|
|
148
148
|
inputs: [
|
|
149
149
|
{ name: 'color', type: 'vec3' },
|
|
@@ -153,7 +153,7 @@ export const AgXToneMapping = /*@__PURE__*/ Fn( ( [ color, exposure ] ) => {
|
|
|
153
153
|
|
|
154
154
|
// https://modelviewer.dev/examples/tone-mapping
|
|
155
155
|
|
|
156
|
-
export const
|
|
156
|
+
export const neutralToneMapping = /*@__PURE__*/ Fn( ( [ color, exposure ] ) => {
|
|
157
157
|
|
|
158
158
|
const StartCompression = float( 0.8 - 0.04 );
|
|
159
159
|
const Desaturation = float( 0.15 );
|
|
@@ -181,7 +181,7 @@ export const NeutralToneMapping = /*@__PURE__*/ Fn( ( [ color, exposure ] ) => {
|
|
|
181
181
|
return mix( color, vec3( newPeak ), g );
|
|
182
182
|
|
|
183
183
|
} ).setLayout( {
|
|
184
|
-
name: '
|
|
184
|
+
name: 'neutralToneMapping',
|
|
185
185
|
type: 'vec3',
|
|
186
186
|
inputs: [
|
|
187
187
|
{ name: 'color', type: 'vec3' },
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import { registerNode } from '../core/Node.js';
|
|
2
1
|
import TempNode from '../core/TempNode.js';
|
|
3
2
|
import { addMethodChaining, nodeObject, vec4 } from '../tsl/TSLCore.js';
|
|
4
3
|
import { rendererReference } from '../accessors/RendererReferenceNode.js';
|
|
5
4
|
|
|
6
5
|
import { NoToneMapping } from '../../constants.js';
|
|
6
|
+
import { hash } from '../core/NodeUtils.js';
|
|
7
7
|
|
|
8
8
|
class ToneMappingNode extends TempNode {
|
|
9
9
|
|
|
10
|
+
static get type() {
|
|
11
|
+
|
|
12
|
+
return 'ToneMappingNode';
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
|
|
10
16
|
constructor( toneMapping, exposureNode = toneMappingExposure, colorNode = null ) {
|
|
11
17
|
|
|
12
18
|
super( 'vec3' );
|
|
@@ -20,10 +26,7 @@ class ToneMappingNode extends TempNode {
|
|
|
20
26
|
|
|
21
27
|
getCacheKey() {
|
|
22
28
|
|
|
23
|
-
|
|
24
|
-
cacheKey = '{toneMapping:' + this.toneMapping + ',nodes:' + cacheKey + '}';
|
|
25
|
-
|
|
26
|
-
return cacheKey;
|
|
29
|
+
return hash( super.getCacheKey(), this.toneMapping );
|
|
27
30
|
|
|
28
31
|
}
|
|
29
32
|
|
|
@@ -58,8 +61,6 @@ class ToneMappingNode extends TempNode {
|
|
|
58
61
|
|
|
59
62
|
export default ToneMappingNode;
|
|
60
63
|
|
|
61
|
-
ToneMappingNode.type = /*@__PURE__*/ registerNode( 'ToneMapping', ToneMappingNode );
|
|
62
|
-
|
|
63
64
|
export const toneMapping = ( mapping, exposure, color ) => nodeObject( new ToneMappingNode( mapping, nodeObject( exposure ), nodeObject( color ) ) );
|
|
64
65
|
export const toneMappingExposure = /*@__PURE__*/ rendererReference( 'toneMappingExposure', 'float' );
|
|
65
66
|
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { float, nodeObject, normalize, vec4 } from '../tsl/TSLBase.js';
|
|
2
|
+
import { Color } from '../../math/Color.js';
|
|
3
|
+
import NodeMaterial from '../../materials/nodes/NodeMaterial.js';
|
|
4
|
+
import { cameraProjectionMatrix } from '../../nodes/accessors/Camera.js';
|
|
5
|
+
import { modelViewMatrix } from '../../nodes/accessors/ModelNode.js';
|
|
6
|
+
import { positionLocal } from '../../nodes/accessors/Position.js';
|
|
7
|
+
import { normalLocal } from '../../nodes/accessors/Normal.js';
|
|
8
|
+
import { BackSide } from '../../constants.js';
|
|
9
|
+
import PassNode from './PassNode.js';
|
|
10
|
+
|
|
11
|
+
class ToonOutlinePassNode extends PassNode {
|
|
12
|
+
|
|
13
|
+
static get type() {
|
|
14
|
+
|
|
15
|
+
return 'ToonOutlinePassNode';
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
constructor( scene, camera, colorNode, thicknessNode, alphaNode ) {
|
|
20
|
+
|
|
21
|
+
super( PassNode.COLOR, scene, camera );
|
|
22
|
+
|
|
23
|
+
this.colorNode = colorNode;
|
|
24
|
+
this.thicknessNode = thicknessNode;
|
|
25
|
+
this.alphaNode = alphaNode;
|
|
26
|
+
|
|
27
|
+
this._materialCache = new WeakMap();
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
updateBefore( frame ) {
|
|
32
|
+
|
|
33
|
+
const { renderer } = frame;
|
|
34
|
+
|
|
35
|
+
const currentRenderObjectFunction = renderer.getRenderObjectFunction();
|
|
36
|
+
|
|
37
|
+
renderer.setRenderObjectFunction( ( object, scene, camera, geometry, material, group, lightsNode ) => {
|
|
38
|
+
|
|
39
|
+
// only render outline for supported materials
|
|
40
|
+
|
|
41
|
+
if ( material.isMeshToonMaterial || material.isMeshToonNodeMaterial ) {
|
|
42
|
+
|
|
43
|
+
if ( material.wireframe === false ) {
|
|
44
|
+
|
|
45
|
+
const outlineMaterial = this._getOutlineMaterial( material );
|
|
46
|
+
renderer.renderObject( object, scene, camera, geometry, outlineMaterial, group, lightsNode );
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// default
|
|
53
|
+
|
|
54
|
+
renderer.renderObject( object, scene, camera, geometry, material, group, lightsNode );
|
|
55
|
+
|
|
56
|
+
} );
|
|
57
|
+
|
|
58
|
+
super.updateBefore( frame );
|
|
59
|
+
|
|
60
|
+
renderer.setRenderObjectFunction( currentRenderObjectFunction );
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
_createMaterial() {
|
|
65
|
+
|
|
66
|
+
const material = new NodeMaterial();
|
|
67
|
+
material.isMeshToonOutlineMaterial = true;
|
|
68
|
+
material.name = 'Toon_Outline';
|
|
69
|
+
material.side = BackSide;
|
|
70
|
+
|
|
71
|
+
// vertex node
|
|
72
|
+
|
|
73
|
+
const outlineNormal = normalLocal.negate();
|
|
74
|
+
const mvp = cameraProjectionMatrix.mul( modelViewMatrix );
|
|
75
|
+
|
|
76
|
+
const ratio = float( 1.0 ); // TODO: support outline thickness ratio for each vertex
|
|
77
|
+
const pos = mvp.mul( vec4( positionLocal, 1.0 ) );
|
|
78
|
+
const pos2 = mvp.mul( vec4( positionLocal.add( outlineNormal ), 1.0 ) );
|
|
79
|
+
const norm = normalize( pos.sub( pos2 ) ); // NOTE: subtract pos2 from pos because BackSide objectNormal is negative
|
|
80
|
+
|
|
81
|
+
material.vertexNode = pos.add( norm.mul( this.thicknessNode ).mul( pos.w ).mul( ratio ) );
|
|
82
|
+
|
|
83
|
+
// color node
|
|
84
|
+
|
|
85
|
+
material.colorNode = vec4( this.colorNode, this.alphaNode );
|
|
86
|
+
|
|
87
|
+
return material;
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
_getOutlineMaterial( originalMaterial ) {
|
|
92
|
+
|
|
93
|
+
let outlineMaterial = this._materialCache.get( originalMaterial );
|
|
94
|
+
|
|
95
|
+
if ( outlineMaterial === undefined ) {
|
|
96
|
+
|
|
97
|
+
outlineMaterial = this._createMaterial();
|
|
98
|
+
|
|
99
|
+
this._materialCache.set( originalMaterial, outlineMaterial );
|
|
100
|
+
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return outlineMaterial;
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export default ToonOutlinePassNode;
|
|
110
|
+
|
|
111
|
+
export const toonOutlinePass = ( scene, camera, color = new Color( 0, 0, 0 ), thickness = 0.003, alpha = 1 ) => nodeObject( new ToonOutlinePassNode( scene, camera, nodeObject( color ), nodeObject( thickness ), nodeObject( alpha ) ) );
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { registerNode } from '../core/Node.js';
|
|
2
1
|
import TempNode from '../core/TempNode.js';
|
|
3
2
|
import { uv } from '../accessors/UV.js';
|
|
4
3
|
import { Fn, nodeObject, float, int, vec4, If } from '../tsl/TSLBase.js';
|
|
@@ -8,6 +7,12 @@ import { convertToTexture } from '../utils/RTTNode.js';
|
|
|
8
7
|
|
|
9
8
|
class TransitionNode extends TempNode {
|
|
10
9
|
|
|
10
|
+
static get type() {
|
|
11
|
+
|
|
12
|
+
return 'TransitionNode';
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
|
|
11
16
|
constructor( textureNodeA, textureNodeB, mixTextureNode, mixRatioNode, thresholdNode, useTextureNode ) {
|
|
12
17
|
|
|
13
18
|
super();
|
|
@@ -72,6 +77,4 @@ class TransitionNode extends TempNode {
|
|
|
72
77
|
|
|
73
78
|
export default TransitionNode;
|
|
74
79
|
|
|
75
|
-
TransitionNode.type = /*@__PURE__*/ registerNode( 'Transition', TransitionNode );
|
|
76
|
-
|
|
77
80
|
export const transition = ( nodeA, nodeB, mixTexture, mixRatio = 0.0, threshold = 0.1, useTexture = 0 ) => nodeObject( new TransitionNode( convertToTexture( nodeA ), convertToTexture( nodeB ), convertToTexture( mixTexture ), nodeObject( mixRatio ), nodeObject( threshold ), nodeObject( useTexture ) ) );
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Node
|
|
1
|
+
import Node from '../core/Node.js';
|
|
2
2
|
import { nodeImmutable, nodeProxy } from '../tsl/TSLBase.js';
|
|
3
3
|
import { cameraNear, cameraFar } from '../accessors/Camera.js';
|
|
4
4
|
import { positionView } from '../accessors/Position.js';
|
|
@@ -6,6 +6,12 @@ import { viewportDepthTexture } from './ViewportDepthTextureNode.js';
|
|
|
6
6
|
|
|
7
7
|
class ViewportDepthNode extends Node {
|
|
8
8
|
|
|
9
|
+
static get type() {
|
|
10
|
+
|
|
11
|
+
return 'ViewportDepthNode';
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
|
|
9
15
|
constructor( scope, valueNode = null ) {
|
|
10
16
|
|
|
11
17
|
super( 'float' );
|
|
@@ -94,8 +100,6 @@ ViewportDepthNode.LINEAR_DEPTH = 'linearDepth';
|
|
|
94
100
|
|
|
95
101
|
export default ViewportDepthNode;
|
|
96
102
|
|
|
97
|
-
ViewportDepthNode.type = /*@__PURE__*/ registerNode( 'ViewportDepth', ViewportDepthNode );
|
|
98
|
-
|
|
99
103
|
// NOTE: viewZ, the z-coordinate in camera space, is negative for points in front of the camera
|
|
100
104
|
|
|
101
105
|
// -near maps to 0; -far maps to 1
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { registerNode } from '../core/Node.js';
|
|
2
1
|
import ViewportTextureNode from './ViewportTextureNode.js';
|
|
3
2
|
import { nodeProxy } from '../tsl/TSLBase.js';
|
|
4
|
-
import {
|
|
3
|
+
import { screenUV } from './ScreenNode.js';
|
|
5
4
|
|
|
6
5
|
import { DepthTexture } from '../../textures/DepthTexture.js';
|
|
7
6
|
|
|
@@ -9,7 +8,13 @@ let sharedDepthbuffer = null;
|
|
|
9
8
|
|
|
10
9
|
class ViewportDepthTextureNode extends ViewportTextureNode {
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
static get type() {
|
|
12
|
+
|
|
13
|
+
return 'ViewportDepthTextureNode';
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
constructor( uvNode = screenUV, levelNode = null ) {
|
|
13
18
|
|
|
14
19
|
if ( sharedDepthbuffer === null ) {
|
|
15
20
|
|
|
@@ -25,6 +30,4 @@ class ViewportDepthTextureNode extends ViewportTextureNode {
|
|
|
25
30
|
|
|
26
31
|
export default ViewportDepthTextureNode;
|
|
27
32
|
|
|
28
|
-
ViewportDepthTextureNode.type = /*@__PURE__*/ registerNode( 'ViewportDepthTexture', ViewportDepthTextureNode );
|
|
29
|
-
|
|
30
33
|
export const viewportDepthTexture = /*@__PURE__*/ nodeProxy( ViewportDepthTextureNode );
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import ViewportTextureNode from './ViewportTextureNode.js';
|
|
2
2
|
import { nodeProxy } from '../tsl/TSLBase.js';
|
|
3
|
-
import {
|
|
3
|
+
import { screenUV } from './ScreenNode.js';
|
|
4
4
|
|
|
5
5
|
import { FramebufferTexture } from '../../textures/FramebufferTexture.js';
|
|
6
|
-
import { registerNode } from '../core/Node.js';
|
|
7
6
|
|
|
8
7
|
let _sharedFramebuffer = null;
|
|
9
8
|
|
|
10
9
|
class ViewportSharedTextureNode extends ViewportTextureNode {
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
static get type() {
|
|
12
|
+
|
|
13
|
+
return 'ViewportSharedTextureNode';
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
constructor( uvNode = screenUV, levelNode = null ) {
|
|
13
18
|
|
|
14
19
|
if ( _sharedFramebuffer === null ) {
|
|
15
20
|
|
|
@@ -31,6 +36,4 @@ class ViewportSharedTextureNode extends ViewportTextureNode {
|
|
|
31
36
|
|
|
32
37
|
export default ViewportSharedTextureNode;
|
|
33
38
|
|
|
34
|
-
ViewportSharedTextureNode.type = /*@__PURE__*/ registerNode( 'ViewportSharedTexture', ViewportSharedTextureNode );
|
|
35
|
-
|
|
36
39
|
export const viewportSharedTexture = /*@__PURE__*/ nodeProxy( ViewportSharedTextureNode );
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { registerNode } from '../core/Node.js';
|
|
2
1
|
import TextureNode from '../accessors/TextureNode.js';
|
|
3
2
|
import { NodeUpdateType } from '../core/constants.js';
|
|
4
3
|
import { nodeProxy } from '../tsl/TSLBase.js';
|
|
5
|
-
import {
|
|
4
|
+
import { screenUV } from './ScreenNode.js';
|
|
6
5
|
|
|
7
6
|
import { Vector2 } from '../../math/Vector2.js';
|
|
8
7
|
import { FramebufferTexture } from '../../textures/FramebufferTexture.js';
|
|
@@ -12,7 +11,13 @@ const _size = /*@__PURE__*/ new Vector2();
|
|
|
12
11
|
|
|
13
12
|
class ViewportTextureNode extends TextureNode {
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
static get type() {
|
|
15
|
+
|
|
16
|
+
return 'ViewportTextureNode';
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
constructor( uvNode = screenUV, levelNode = null, framebufferTexture = null ) {
|
|
16
21
|
|
|
17
22
|
if ( framebufferTexture === null ) {
|
|
18
23
|
|
|
@@ -72,7 +77,5 @@ class ViewportTextureNode extends TextureNode {
|
|
|
72
77
|
|
|
73
78
|
export default ViewportTextureNode;
|
|
74
79
|
|
|
75
|
-
ViewportTextureNode.type = /*@__PURE__*/ registerNode( 'ViewportTexture', ViewportTextureNode );
|
|
76
|
-
|
|
77
80
|
export const viewportTexture = /*@__PURE__*/ nodeProxy( ViewportTextureNode );
|
|
78
81
|
export const viewportMipTexture = /*@__PURE__*/ nodeProxy( ViewportTextureNode, null, null, { generateMipmaps: true } );
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { registerNode } from '../core/Node.js';
|
|
2
1
|
import FogNode from './FogNode.js';
|
|
3
2
|
import { nodeProxy } from '../tsl/TSLBase.js';
|
|
4
3
|
|
|
5
4
|
class FogExp2Node extends FogNode {
|
|
6
5
|
|
|
6
|
+
static get type() {
|
|
7
|
+
|
|
8
|
+
return 'FogExp2Node';
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
7
12
|
constructor( colorNode, densityNode ) {
|
|
8
13
|
|
|
9
14
|
super( colorNode );
|
|
@@ -27,6 +32,4 @@ class FogExp2Node extends FogNode {
|
|
|
27
32
|
|
|
28
33
|
export default FogExp2Node;
|
|
29
34
|
|
|
30
|
-
FogExp2Node.type = /*@__PURE__*/ registerNode( 'FogExp2', FogExp2Node );
|
|
31
|
-
|
|
32
35
|
export const densityFog = /*@__PURE__*/ nodeProxy( FogExp2Node );
|