@needle-tools/three 0.153.0 → 0.154.1
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 +112 -364
- package/build/three.js +112 -364
- package/build/three.min.js +1 -1
- package/build/three.module.js +113 -346
- package/build/three.module.min.js +1 -1
- package/examples/jsm/controls/ArcballControls.js +2 -1
- package/examples/jsm/controls/FlyControls.js +25 -9
- package/examples/jsm/controls/OrbitControls.js +7 -1
- package/examples/jsm/csm/CSM.js +1 -1
- package/examples/jsm/effects/AnaglyphEffect.js +1 -1
- package/examples/jsm/effects/OutlineEffect.js +1 -1
- package/examples/jsm/effects/ParallaxBarrierEffect.js +1 -1
- package/examples/jsm/environments/RoomEnvironment.js +6 -2
- package/examples/jsm/lines/LineMaterial.js +1 -1
- package/examples/jsm/loaders/3DMLoader.js +1 -1
- package/examples/jsm/loaders/3MFLoader.js +5 -1
- package/examples/jsm/loaders/AMFLoader.js +5 -1
- package/examples/jsm/loaders/ColladaLoader.js +4 -1
- package/examples/jsm/loaders/FBXLoader.js +9 -2
- package/examples/jsm/loaders/LDrawLoader.js +4 -7
- package/examples/jsm/loaders/PLYLoader.js +16 -6
- package/examples/jsm/loaders/VRMLLoader.js +16 -4
- package/examples/jsm/materials/MeshGouraudMaterial.js +2 -2
- package/examples/jsm/math/MeshSurfaceSampler.js +76 -35
- package/examples/jsm/nodes/Nodes.js +20 -15
- package/examples/jsm/nodes/accessors/BufferAttributeNode.js +21 -8
- package/examples/jsm/nodes/accessors/CameraNode.js +25 -4
- package/examples/jsm/nodes/accessors/ExtendedMaterialNode.js +7 -1
- package/examples/jsm/nodes/accessors/InstanceNode.js +2 -4
- package/examples/jsm/nodes/accessors/MaterialNode.js +55 -47
- package/examples/jsm/nodes/accessors/ModelNode.js +3 -1
- package/examples/jsm/nodes/accessors/MorphNode.js +70 -0
- package/examples/jsm/nodes/accessors/NormalNode.js +3 -2
- package/examples/jsm/nodes/accessors/Object3DNode.js +10 -2
- package/examples/jsm/nodes/accessors/SceneNode.js +46 -0
- package/examples/jsm/nodes/accessors/SkinningNode.js +43 -62
- package/examples/jsm/nodes/accessors/TangentNode.js +2 -2
- package/examples/jsm/nodes/accessors/TextureBicubicNode.js +94 -0
- package/examples/jsm/nodes/accessors/TextureNode.js +68 -6
- package/examples/jsm/nodes/accessors/TextureSizeNode.js +35 -0
- package/examples/jsm/nodes/accessors/UVNode.js +1 -1
- package/examples/jsm/nodes/code/CodeNode.js +3 -0
- package/examples/jsm/nodes/code/FunctionNode.js +25 -4
- package/examples/jsm/nodes/core/BypassNode.js +2 -2
- package/examples/jsm/nodes/core/ContextNode.js +2 -0
- package/examples/jsm/nodes/core/IndexNode.js +66 -0
- package/examples/jsm/nodes/core/LightingModel.js +2 -1
- package/examples/jsm/nodes/core/Node.js +12 -15
- package/examples/jsm/nodes/core/NodeBuilder.js +24 -5
- package/examples/jsm/nodes/core/PropertyNode.js +4 -0
- package/examples/jsm/nodes/core/StackNode.js +1 -1
- package/examples/jsm/nodes/core/UniformNode.js +1 -1
- package/examples/jsm/nodes/core/VarNode.js +1 -3
- package/examples/jsm/nodes/display/BlendModeNode.js +9 -9
- package/examples/jsm/nodes/display/ColorAdjustmentNode.js +7 -7
- package/examples/jsm/nodes/display/ColorSpaceNode.js +50 -49
- package/examples/jsm/nodes/display/NormalMapNode.js +3 -3
- package/examples/jsm/nodes/display/ToneMappingNode.js +8 -8
- package/examples/jsm/nodes/display/ViewportDepthNode.js +69 -0
- package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +34 -0
- package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +6 -5
- package/examples/jsm/nodes/display/ViewportTextureNode.js +23 -15
- package/examples/jsm/nodes/functions/BSDF/BRDF_BlinnPhong.js +5 -5
- package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +10 -8
- package/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
- package/examples/jsm/nodes/functions/BSDF/BRDF_Sheen.js +43 -0
- package/examples/jsm/nodes/functions/BSDF/DFGApprox.js +4 -4
- package/examples/jsm/nodes/functions/BSDF/D_GGX.js +2 -2
- package/examples/jsm/nodes/functions/BSDF/EnvironmentBRDF.js +13 -0
- package/examples/jsm/nodes/functions/BSDF/F_Schlick.js +2 -4
- package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +2 -2
- package/examples/jsm/nodes/functions/PhongLightingModel.js +7 -7
- package/examples/jsm/nodes/functions/PhysicalLightingModel.js +129 -18
- package/examples/jsm/nodes/functions/material/getGeometryRoughness.js +2 -2
- package/examples/jsm/nodes/functions/material/getRoughness.js +3 -3
- package/examples/jsm/nodes/geometry/RangeNode.js +1 -1
- package/examples/jsm/nodes/lighting/DirectionalLightNode.js +2 -2
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +91 -62
- package/examples/jsm/nodes/lighting/LightUtils.js +2 -2
- package/examples/jsm/nodes/lighting/LightingContextNode.js +17 -15
- package/examples/jsm/nodes/lighting/PointLightNode.js +3 -3
- package/examples/jsm/nodes/lighting/SpotLightNode.js +3 -3
- package/examples/jsm/nodes/materials/LineBasicNodeMaterial.js +0 -15
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +0 -15
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +0 -10
- package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +0 -9
- package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +41 -0
- package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +1 -14
- package/examples/jsm/nodes/materials/NodeMaterial.js +79 -28
- package/examples/jsm/nodes/materials/PointsNodeMaterial.js +0 -9
- package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +0 -7
- package/examples/jsm/nodes/materialx/lib/mx_hsv.js +3 -3
- package/examples/jsm/nodes/materialx/lib/mx_noise.js +14 -14
- package/examples/jsm/nodes/materialx/lib/mx_transform_color.js +4 -4
- package/examples/jsm/nodes/math/MathNode.js +6 -0
- package/examples/jsm/nodes/math/OperatorNode.js +1 -1
- package/examples/jsm/nodes/procedural/CheckerNode.js +3 -3
- package/examples/jsm/nodes/shadernode/ShaderNode.js +24 -4
- package/examples/jsm/nodes/utils/LoopNode.js +1 -1
- package/examples/jsm/nodes/utils/TriplanarTexturesNode.js +1 -1
- package/examples/jsm/objects/GroundProjectedSkybox.js +1 -1
- package/examples/jsm/objects/Reflector.js +1 -1
- package/examples/jsm/objects/Refractor.js +1 -1
- package/examples/jsm/objects/Sky.js +1 -1
- package/examples/jsm/objects/Water.js +1 -1
- package/examples/jsm/objects/Water2.js +1 -1
- package/examples/jsm/offscreen/scene.js +1 -0
- package/examples/jsm/postprocessing/EffectComposer.js +2 -0
- package/examples/jsm/postprocessing/OutlinePass.js +1 -3
- package/examples/jsm/postprocessing/SSAARenderPass.js +3 -12
- package/examples/jsm/postprocessing/SavePass.js +3 -1
- package/examples/jsm/postprocessing/TAARenderPass.js +14 -2
- package/examples/jsm/postprocessing/TexturePass.js +2 -1
- package/examples/jsm/postprocessing/UnrealBloomPass.js +9 -10
- package/examples/jsm/renderers/common/Backend.js +2 -0
- package/examples/jsm/renderers/common/Background.js +7 -6
- package/examples/jsm/renderers/common/Pipelines.js +26 -14
- package/examples/jsm/renderers/common/RenderObject.js +18 -0
- package/examples/jsm/renderers/common/RenderObjects.js +29 -29
- package/examples/jsm/renderers/common/Renderer.js +48 -6
- package/examples/jsm/renderers/common/nodes/Nodes.js +1 -1
- package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +340 -0
- package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +23 -19
- package/examples/jsm/renderers/webgpu/WebGPUBackend.js +123 -41
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +29 -9
- package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +4 -0
- package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +8 -13
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +85 -3
- package/examples/jsm/renderers/webgpu/utils/WebGPUUtils.js +5 -1
- package/examples/jsm/shaders/BlendShader.js +1 -2
- package/examples/jsm/shaders/BokehShader2.js +1 -1
- package/examples/jsm/shaders/CopyShader.js +2 -2
- package/examples/jsm/shaders/ToonShader.js +4 -4
- package/examples/jsm/shaders/WaterRefractionShader.js +1 -1
- package/examples/jsm/webxr/OculusHandPointerModel.js +34 -13
- package/package.json +2 -1
- package/src/Three.Legacy.js +0 -228
- package/src/animation/PropertyBinding.js +1 -1
- package/src/constants.js +1 -1
- package/src/core/BufferAttribute.js +0 -24
- package/src/core/BufferGeometry.js +0 -7
- package/src/loaders/Loader.js +2 -0
- package/src/loaders/MaterialLoader.js +1 -0
- package/src/materials/Material.js +3 -0
- package/src/objects/Skeleton.js +0 -2
- package/src/renderers/WebGLRenderer.js +9 -21
- package/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.js +68 -0
- package/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +9 -1
- package/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk.js +10 -6
- package/src/renderers/shaders/ShaderLib/background.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/cube.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/distanceRGBA.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/equirect.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +2 -2
- package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +4 -2
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +4 -2
- package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +4 -2
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +4 -2
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +4 -2
- package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +4 -2
- package/src/renderers/shaders/ShaderLib/points.glsl.js +4 -2
- package/src/renderers/shaders/ShaderLib/shadow.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/sprite.glsl.js +4 -2
- package/src/renderers/webgl/WebGLObjects.js +23 -3
- package/src/renderers/webgl/WebGLProgram.js +24 -5
- package/src/renderers/webgl/WebGLPrograms.js +3 -0
- package/src/renderers/webxr/WebXRManager.js +11 -29
- package/src/scenes/Scene.js +0 -14
- package/examples/jsm/nodes/core/InstanceIndexNode.js +0 -45
- /package/src/renderers/shaders/ShaderChunk/{encodings_fragment.glsl.js → colorspace_fragment.glsl.js} +0 -0
- /package/src/renderers/shaders/ShaderChunk/{encodings_pars_fragment.glsl.js → colorspace_pars_fragment.glsl.js} +0 -0
- /package/src/renderers/shaders/ShaderChunk/{output_fragment.glsl.js → opaque_fragment.glsl.js} +0 -0
|
@@ -43,13 +43,14 @@ const toFloat = ( value ) => {
|
|
|
43
43
|
|
|
44
44
|
class NodeBuilder {
|
|
45
45
|
|
|
46
|
-
constructor( object, renderer, parser ) {
|
|
46
|
+
constructor( object, renderer, parser, scene = null ) {
|
|
47
47
|
|
|
48
48
|
this.object = object;
|
|
49
|
-
this.material = object &&
|
|
50
|
-
this.geometry = object &&
|
|
49
|
+
this.material = ( object && object.material ) || null;
|
|
50
|
+
this.geometry = ( object && object.geometry ) || null;
|
|
51
51
|
this.renderer = renderer;
|
|
52
52
|
this.parser = parser;
|
|
53
|
+
this.scene = scene;
|
|
53
54
|
|
|
54
55
|
this.nodes = [];
|
|
55
56
|
this.updateNodes = [];
|
|
@@ -97,6 +98,12 @@ class NodeBuilder {
|
|
|
97
98
|
|
|
98
99
|
}
|
|
99
100
|
|
|
101
|
+
includes( node ) {
|
|
102
|
+
|
|
103
|
+
return this.nodes.includes( node );
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
|
|
100
107
|
getBindings() {
|
|
101
108
|
|
|
102
109
|
let bindingsArray = this.bindingsArray;
|
|
@@ -228,6 +235,12 @@ class NodeBuilder {
|
|
|
228
235
|
|
|
229
236
|
}
|
|
230
237
|
|
|
238
|
+
getVertexIndex() {
|
|
239
|
+
|
|
240
|
+
console.warn( 'Abstract function.' );
|
|
241
|
+
|
|
242
|
+
}
|
|
243
|
+
|
|
231
244
|
getInstanceIndex() {
|
|
232
245
|
|
|
233
246
|
console.warn( 'Abstract function.' );
|
|
@@ -384,6 +397,12 @@ class NodeBuilder {
|
|
|
384
397
|
|
|
385
398
|
}
|
|
386
399
|
|
|
400
|
+
needsColorSpaceToLinear( /*texture*/ ) {
|
|
401
|
+
|
|
402
|
+
return false;
|
|
403
|
+
|
|
404
|
+
}
|
|
405
|
+
|
|
387
406
|
/** @deprecated, r152 */
|
|
388
407
|
getTextureEncodingFromMap( map ) {
|
|
389
408
|
|
|
@@ -582,7 +601,7 @@ class NodeBuilder {
|
|
|
582
601
|
|
|
583
602
|
}
|
|
584
603
|
|
|
585
|
-
getUniformFromNode( node, type, shaderStage = this.shaderStage ) {
|
|
604
|
+
getUniformFromNode( node, type, shaderStage = this.shaderStage, name = null ) {
|
|
586
605
|
|
|
587
606
|
const nodeData = this.getDataFromNode( node, shaderStage );
|
|
588
607
|
|
|
@@ -592,7 +611,7 @@ class NodeBuilder {
|
|
|
592
611
|
|
|
593
612
|
const index = this.uniforms.index ++;
|
|
594
613
|
|
|
595
|
-
nodeUniform = new NodeUniform( 'nodeUniform' + index, type, node );
|
|
614
|
+
nodeUniform = new NodeUniform( name || ( 'nodeUniform' + index ), type, node );
|
|
596
615
|
|
|
597
616
|
this.uniforms[ shaderStage ].push( nodeUniform );
|
|
598
617
|
|
|
@@ -47,6 +47,10 @@ export const property = ( type, name ) => nodeObject( new PropertyNode( type, na
|
|
|
47
47
|
export const diffuseColor = nodeImmutable( PropertyNode, 'vec4', 'DiffuseColor' );
|
|
48
48
|
export const roughness = nodeImmutable( PropertyNode, 'float', 'Roughness' );
|
|
49
49
|
export const metalness = nodeImmutable( PropertyNode, 'float', 'Metalness' );
|
|
50
|
+
export const clearcoat = nodeImmutable( PropertyNode, 'float', 'Clearcoat' );
|
|
51
|
+
export const clearcoatRoughness = nodeImmutable( PropertyNode, 'float', 'ClearcoatRoughness' );
|
|
52
|
+
export const sheen = nodeImmutable( PropertyNode, 'vec3', 'Sheen' );
|
|
53
|
+
export const sheenRoughness = nodeImmutable( PropertyNode, 'float', 'SheenRoughness' );
|
|
50
54
|
export const specularColor = nodeImmutable( PropertyNode, 'color', 'SpecularColor' );
|
|
51
55
|
export const shininess = nodeImmutable( PropertyNode, 'float', 'Shininess' );
|
|
52
56
|
|
|
@@ -36,7 +36,7 @@ class UniformNode extends InputNode {
|
|
|
36
36
|
|
|
37
37
|
const sharedNodeType = sharedNode.getInputType( builder );
|
|
38
38
|
|
|
39
|
-
const nodeUniform = builder.getUniformFromNode( sharedNode, sharedNodeType, builder.shaderStage );
|
|
39
|
+
const nodeUniform = builder.getUniformFromNode( sharedNode, sharedNodeType, builder.shaderStage, builder.context.label );
|
|
40
40
|
const propertyName = builder.getPropertyName( nodeUniform );
|
|
41
41
|
|
|
42
42
|
return builder.format( propertyName, type, output );
|
|
@@ -80,10 +80,8 @@ class VarNode extends Node {
|
|
|
80
80
|
|
|
81
81
|
export default VarNode;
|
|
82
82
|
|
|
83
|
-
export const
|
|
84
|
-
export const temp = label;
|
|
83
|
+
export const temp = nodeProxy( VarNode );
|
|
85
84
|
|
|
86
|
-
addNodeElement( 'label', label );
|
|
87
85
|
addNodeElement( 'temp', temp );
|
|
88
86
|
|
|
89
87
|
addNodeClass( VarNode );
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import TempNode from '../core/TempNode.js';
|
|
2
2
|
import { EPSILON } from '../math/MathNode.js';
|
|
3
3
|
import { addNodeClass } from '../core/Node.js';
|
|
4
|
-
import { addNodeElement,
|
|
4
|
+
import { addNodeElement, tslFn, nodeProxy, vec3 } from '../shadernode/ShaderNode.js';
|
|
5
5
|
|
|
6
|
-
export const BurnNode =
|
|
6
|
+
export const BurnNode = tslFn( ( { base, blend } ) => {
|
|
7
7
|
|
|
8
8
|
const fn = ( c ) => blend[ c ].lessThan( EPSILON ).cond( blend[ c ], base[ c ].oneMinus().div( blend[ c ] ).oneMinus().max( 0 ) );
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@ export const BurnNode = new ShaderNode( ( { base, blend } ) => {
|
|
|
11
11
|
|
|
12
12
|
} );
|
|
13
13
|
|
|
14
|
-
export const DodgeNode =
|
|
14
|
+
export const DodgeNode = tslFn( ( { base, blend } ) => {
|
|
15
15
|
|
|
16
16
|
const fn = ( c ) => blend[ c ].equal( 1.0 ).cond( blend[ c ], base[ c ].div( blend[ c ].oneMinus() ).max( 0 ) );
|
|
17
17
|
|
|
@@ -19,7 +19,7 @@ export const DodgeNode = new ShaderNode( ( { base, blend } ) => {
|
|
|
19
19
|
|
|
20
20
|
} );
|
|
21
21
|
|
|
22
|
-
export const ScreenNode =
|
|
22
|
+
export const ScreenNode = tslFn( ( { base, blend } ) => {
|
|
23
23
|
|
|
24
24
|
const fn = ( c ) => base[ c ].oneMinus().mul( blend[ c ].oneMinus() ).oneMinus();
|
|
25
25
|
|
|
@@ -27,7 +27,7 @@ export const ScreenNode = new ShaderNode( ( { base, blend } ) => {
|
|
|
27
27
|
|
|
28
28
|
} );
|
|
29
29
|
|
|
30
|
-
export const OverlayNode =
|
|
30
|
+
export const OverlayNode = tslFn( ( { base, blend } ) => {
|
|
31
31
|
|
|
32
32
|
const fn = ( c ) => base[ c ].lessThan( 0.5 ).cond( base[ c ].mul( blend[ c ], 2.0 ), base[ c ].oneMinus().mul( blend[ c ].oneMinus() ).oneMinus() );
|
|
33
33
|
|
|
@@ -57,19 +57,19 @@ class BlendModeNode extends TempNode {
|
|
|
57
57
|
|
|
58
58
|
if ( blendMode === BlendModeNode.BURN ) {
|
|
59
59
|
|
|
60
|
-
outputNode = BurnNode
|
|
60
|
+
outputNode = BurnNode( params );
|
|
61
61
|
|
|
62
62
|
} else if ( blendMode === BlendModeNode.DODGE ) {
|
|
63
63
|
|
|
64
|
-
outputNode = DodgeNode
|
|
64
|
+
outputNode = DodgeNode( params );
|
|
65
65
|
|
|
66
66
|
} else if ( blendMode === BlendModeNode.SCREEN ) {
|
|
67
67
|
|
|
68
|
-
outputNode = ScreenNode
|
|
68
|
+
outputNode = ScreenNode( params );
|
|
69
69
|
|
|
70
70
|
} else if ( blendMode === BlendModeNode.OVERLAY ) {
|
|
71
71
|
|
|
72
|
-
outputNode = OverlayNode
|
|
72
|
+
outputNode = OverlayNode( params );
|
|
73
73
|
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -2,15 +2,15 @@ import TempNode from '../core/TempNode.js';
|
|
|
2
2
|
import { dot, mix } from '../math/MathNode.js';
|
|
3
3
|
import { add } from '../math/OperatorNode.js';
|
|
4
4
|
import { addNodeClass } from '../core/Node.js';
|
|
5
|
-
import { addNodeElement,
|
|
5
|
+
import { addNodeElement, tslFn, nodeProxy, float, vec3, mat3 } from '../shadernode/ShaderNode.js';
|
|
6
6
|
|
|
7
|
-
const saturationNode =
|
|
7
|
+
const saturationNode = tslFn( ( { color, adjustment } ) => {
|
|
8
8
|
|
|
9
9
|
return adjustment.mix( luminance( color ), color );
|
|
10
10
|
|
|
11
11
|
} );
|
|
12
12
|
|
|
13
|
-
const vibranceNode =
|
|
13
|
+
const vibranceNode = tslFn( ( { color, adjustment } ) => {
|
|
14
14
|
|
|
15
15
|
const average = add( color.r, color.g, color.b ).div( 3.0 );
|
|
16
16
|
|
|
@@ -21,7 +21,7 @@ const vibranceNode = new ShaderNode( ( { color, adjustment } ) => {
|
|
|
21
21
|
|
|
22
22
|
} );
|
|
23
23
|
|
|
24
|
-
const hueNode =
|
|
24
|
+
const hueNode = tslFn( ( { color, adjustment } ) => {
|
|
25
25
|
|
|
26
26
|
const RGBtoYIQ = mat3( 0.299, 0.587, 0.114, 0.595716, - 0.274453, - 0.321263, 0.211456, - 0.522591, 0.311135 );
|
|
27
27
|
const YIQtoRGB = mat3( 1.0, 0.9563, 0.6210, 1.0, - 0.2721, - 0.6474, 1.0, - 1.107, 1.7046 );
|
|
@@ -58,15 +58,15 @@ class ColorAdjustmentNode extends TempNode {
|
|
|
58
58
|
|
|
59
59
|
if ( method === ColorAdjustmentNode.SATURATION ) {
|
|
60
60
|
|
|
61
|
-
outputNode = saturationNode
|
|
61
|
+
outputNode = saturationNode( callParams );
|
|
62
62
|
|
|
63
63
|
} else if ( method === ColorAdjustmentNode.VIBRANCE ) {
|
|
64
64
|
|
|
65
|
-
outputNode = vibranceNode
|
|
65
|
+
outputNode = vibranceNode( callParams );
|
|
66
66
|
|
|
67
67
|
} else if ( method === ColorAdjustmentNode.HUE ) {
|
|
68
68
|
|
|
69
|
-
outputNode = hueNode
|
|
69
|
+
outputNode = hueNode( callParams );
|
|
70
70
|
|
|
71
71
|
} else {
|
|
72
72
|
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import TempNode from '../core/TempNode.js';
|
|
2
2
|
import { mix } from '../math/MathNode.js';
|
|
3
3
|
import { addNodeClass } from '../core/Node.js';
|
|
4
|
-
import { addNodeElement,
|
|
4
|
+
import { addNodeElement, tslFn, nodeObject, nodeProxy, vec4 } from '../shadernode/ShaderNode.js';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { LinearSRGBColorSpace, SRGBColorSpace } from 'three';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const sRGBToLinearShader = tslFn( ( inputs ) => {
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const { value } = inputs;
|
|
11
|
+
const { rgb } = value;
|
|
12
|
+
|
|
13
|
+
const a = rgb.mul( 0.9478672986 ).add( 0.0521327014 ).pow( 2.4 );
|
|
14
|
+
const b = rgb.mul( 0.0773993808 );
|
|
15
|
+
const factor = rgb.lessThanEqual( 0.04045 );
|
|
16
|
+
|
|
17
|
+
const rgbResult = mix( a, b, factor );
|
|
18
|
+
|
|
19
|
+
return vec4( rgbResult, value.a );
|
|
11
20
|
|
|
12
21
|
} );
|
|
13
22
|
|
|
14
|
-
|
|
23
|
+
const LinearTosRGBShader = tslFn( ( inputs ) => {
|
|
15
24
|
|
|
16
25
|
const { value } = inputs;
|
|
17
26
|
const { rgb } = value;
|
|
@@ -26,62 +35,38 @@ export const LinearTosRGB = new ShaderNode( ( inputs ) => {
|
|
|
26
35
|
|
|
27
36
|
} );
|
|
28
37
|
|
|
29
|
-
const
|
|
30
|
-
LinearToLinear,
|
|
31
|
-
LinearTosRGB
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
class ColorSpaceNode extends TempNode {
|
|
35
|
-
|
|
36
|
-
constructor( method, node ) {
|
|
37
|
-
|
|
38
|
-
super( 'vec4' );
|
|
39
|
-
|
|
40
|
-
this.method = method;
|
|
41
|
-
|
|
42
|
-
this.node = node;
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
fromColorSpace( colorSpace ) {
|
|
47
|
-
|
|
48
|
-
let method = null;
|
|
49
|
-
|
|
50
|
-
if ( colorSpace === LinearSRGBColorSpace ) {
|
|
38
|
+
const getColorSpaceMethod = ( colorSpace ) => {
|
|
51
39
|
|
|
52
|
-
|
|
40
|
+
let method = null;
|
|
53
41
|
|
|
54
|
-
|
|
42
|
+
if ( colorSpace === LinearSRGBColorSpace ) {
|
|
55
43
|
|
|
56
|
-
|
|
44
|
+
method = 'Linear';
|
|
57
45
|
|
|
58
|
-
|
|
46
|
+
} else if ( colorSpace === SRGBColorSpace ) {
|
|
59
47
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return this;
|
|
48
|
+
method = 'sRGB';
|
|
63
49
|
|
|
64
50
|
}
|
|
65
51
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
console.warn( 'THREE.ColorSpaceNode: Method .fromEncoding renamed to .fromColorSpace.' );
|
|
52
|
+
return method;
|
|
69
53
|
|
|
70
|
-
|
|
54
|
+
};
|
|
71
55
|
|
|
72
|
-
|
|
56
|
+
const getMethod = ( source, target ) => {
|
|
73
57
|
|
|
74
|
-
|
|
58
|
+
return getColorSpaceMethod( source ) + 'To' + getColorSpaceMethod( target );
|
|
75
59
|
|
|
76
|
-
|
|
60
|
+
};
|
|
77
61
|
|
|
78
|
-
|
|
62
|
+
class ColorSpaceNode extends TempNode {
|
|
79
63
|
|
|
80
|
-
|
|
64
|
+
constructor( method, node ) {
|
|
81
65
|
|
|
82
|
-
|
|
66
|
+
super( 'vec4' );
|
|
83
67
|
|
|
84
|
-
|
|
68
|
+
this.method = method;
|
|
69
|
+
this.node = node;
|
|
85
70
|
|
|
86
71
|
}
|
|
87
72
|
|
|
@@ -89,19 +74,35 @@ class ColorSpaceNode extends TempNode {
|
|
|
89
74
|
|
|
90
75
|
const { method, node } = this;
|
|
91
76
|
|
|
92
|
-
|
|
77
|
+
if ( method === ColorSpaceNode.LINEAR_TO_LINEAR )
|
|
78
|
+
return node;
|
|
79
|
+
|
|
80
|
+
return Methods[ method ]( { value: node } );
|
|
93
81
|
|
|
94
82
|
}
|
|
95
83
|
|
|
96
84
|
}
|
|
97
85
|
|
|
98
86
|
ColorSpaceNode.LINEAR_TO_LINEAR = 'LinearToLinear';
|
|
99
|
-
ColorSpaceNode.
|
|
87
|
+
ColorSpaceNode.LINEAR_TO_sRGB = 'LinearTosRGB';
|
|
88
|
+
ColorSpaceNode.sRGB_TO_LINEAR = 'sRGBToLinear';
|
|
89
|
+
|
|
90
|
+
const Methods = {
|
|
91
|
+
[ ColorSpaceNode.LINEAR_TO_sRGB ]: LinearTosRGBShader,
|
|
92
|
+
[ ColorSpaceNode.sRGB_TO_LINEAR ]: sRGBToLinearShader
|
|
93
|
+
};
|
|
100
94
|
|
|
101
95
|
export default ColorSpaceNode;
|
|
102
96
|
|
|
103
|
-
export const
|
|
97
|
+
export const linearToColorSpace = ( node, colorSpace ) => nodeObject( new ColorSpaceNode( getMethod( LinearSRGBColorSpace, colorSpace ), nodeObject( node ) ) );
|
|
98
|
+
export const colorSpaceToLinear = ( node, colorSpace ) => nodeObject( new ColorSpaceNode( getMethod( colorSpace, LinearSRGBColorSpace ), nodeObject( node ) ) );
|
|
99
|
+
|
|
100
|
+
export const linearTosRGB = nodeProxy( ColorSpaceNode, ColorSpaceNode.LINEAR_TO_sRGB );
|
|
101
|
+
export const sRGBToLinear = nodeProxy( ColorSpaceNode, ColorSpaceNode.sRGB_TO_LINEAR );
|
|
104
102
|
|
|
105
|
-
addNodeElement( '
|
|
103
|
+
addNodeElement( 'linearTosRGB', linearTosRGB );
|
|
104
|
+
addNodeElement( 'sRGBToLinear', sRGBToLinear );
|
|
105
|
+
addNodeElement( 'linearToColorSpace', linearToColorSpace );
|
|
106
|
+
addNodeElement( 'colorSpaceToLinear', colorSpaceToLinear );
|
|
106
107
|
|
|
107
108
|
addNodeClass( ColorSpaceNode );
|
|
@@ -8,14 +8,14 @@ import { tangentView } from '../accessors/TangentNode.js';
|
|
|
8
8
|
import { uv } from '../accessors/UVNode.js';
|
|
9
9
|
import { faceDirection } from './FrontFacingNode.js';
|
|
10
10
|
import { addNodeClass } from '../core/Node.js';
|
|
11
|
-
import {
|
|
11
|
+
import { tslFn, nodeProxy, vec3, mat3 } from '../shadernode/ShaderNode.js';
|
|
12
12
|
|
|
13
13
|
import { TangentSpaceNormalMap, ObjectSpaceNormalMap } from 'three';
|
|
14
14
|
|
|
15
15
|
// Normal Mapping Without Precomputed Tangents
|
|
16
16
|
// http://www.thetenthplanet.de/archives/1180
|
|
17
17
|
|
|
18
|
-
const perturbNormal2ArbNode =
|
|
18
|
+
const perturbNormal2ArbNode = tslFn( ( inputs ) => {
|
|
19
19
|
|
|
20
20
|
const { eye_pos, surf_norm, mapN, uv } = inputs;
|
|
21
21
|
|
|
@@ -80,7 +80,7 @@ class NormalMapNode extends TempNode {
|
|
|
80
80
|
|
|
81
81
|
} else {
|
|
82
82
|
|
|
83
|
-
outputNode = perturbNormal2ArbNode
|
|
83
|
+
outputNode = perturbNormal2ArbNode( {
|
|
84
84
|
eye_pos: positionView,
|
|
85
85
|
surf_norm: normalView,
|
|
86
86
|
mapN: normalMap,
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import TempNode from '../core/TempNode.js';
|
|
2
2
|
import { addNodeClass } from '../core/Node.js';
|
|
3
|
-
import {
|
|
3
|
+
import { tslFn, nodeObject, float, mat3 } from '../shadernode/ShaderNode.js';
|
|
4
4
|
|
|
5
5
|
import { NoToneMapping, LinearToneMapping, ReinhardToneMapping, CineonToneMapping, ACESFilmicToneMapping } from 'three';
|
|
6
6
|
|
|
7
7
|
// exposure only
|
|
8
|
-
const LinearToneMappingNode =
|
|
8
|
+
const LinearToneMappingNode = tslFn( ( { color, exposure } ) => {
|
|
9
9
|
|
|
10
10
|
return color.mul( exposure ).clamp();
|
|
11
11
|
|
|
12
12
|
} );
|
|
13
13
|
|
|
14
14
|
// source: https://www.cs.utah.edu/docs/techreports/2002/pdf/UUCS-02-001.pdf
|
|
15
|
-
const ReinhardToneMappingNode =
|
|
15
|
+
const ReinhardToneMappingNode = tslFn( ( { color, exposure } ) => {
|
|
16
16
|
|
|
17
17
|
color = color.mul( exposure );
|
|
18
18
|
|
|
@@ -21,7 +21,7 @@ const ReinhardToneMappingNode = new ShaderNode( ( { color, exposure } ) => {
|
|
|
21
21
|
} );
|
|
22
22
|
|
|
23
23
|
// source: http://filmicworlds.com/blog/filmic-tonemapping-operators/
|
|
24
|
-
const OptimizedCineonToneMappingNode =
|
|
24
|
+
const OptimizedCineonToneMappingNode = tslFn( ( { color, exposure } ) => {
|
|
25
25
|
|
|
26
26
|
// optimized filmic operator by Jim Hejl and Richard Burgess-Dawson
|
|
27
27
|
color = color.mul( exposure );
|
|
@@ -35,7 +35,7 @@ const OptimizedCineonToneMappingNode = new ShaderNode( ( { color, exposure } ) =
|
|
|
35
35
|
} );
|
|
36
36
|
|
|
37
37
|
// source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs
|
|
38
|
-
const RRTAndODTFit =
|
|
38
|
+
const RRTAndODTFit = tslFn( ( { color } ) => {
|
|
39
39
|
|
|
40
40
|
const a = color.mul( color.add( 0.0245786 ) ).sub( 0.000090537 );
|
|
41
41
|
const b = color.mul( color.add( 0.4329510 ).mul( 0.983729 ) ).add( 0.238081 );
|
|
@@ -45,7 +45,7 @@ const RRTAndODTFit = new ShaderNode( ( { color } ) => {
|
|
|
45
45
|
} );
|
|
46
46
|
|
|
47
47
|
// source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs
|
|
48
|
-
const ACESFilmicToneMappingNode =
|
|
48
|
+
const ACESFilmicToneMappingNode = tslFn( ( { color, exposure } ) => {
|
|
49
49
|
|
|
50
50
|
// sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT
|
|
51
51
|
const ACESInputMat = mat3(
|
|
@@ -66,7 +66,7 @@ const ACESFilmicToneMappingNode = new ShaderNode( ( { color, exposure } ) => {
|
|
|
66
66
|
color = ACESInputMat.mul( color );
|
|
67
67
|
|
|
68
68
|
// Apply RRT and ODT
|
|
69
|
-
color = RRTAndODTFit
|
|
69
|
+
color = RRTAndODTFit( { color } );
|
|
70
70
|
|
|
71
71
|
color = ACESOutputMat.mul( color );
|
|
72
72
|
|
|
@@ -118,7 +118,7 @@ class ToneMappingNode extends TempNode {
|
|
|
118
118
|
|
|
119
119
|
if ( toneMappingNode ) {
|
|
120
120
|
|
|
121
|
-
outputNode = toneMappingNode
|
|
121
|
+
outputNode = toneMappingNode( toneMappingParams );
|
|
122
122
|
|
|
123
123
|
} else {
|
|
124
124
|
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import Node, { addNodeClass } from '../core/Node.js';
|
|
2
|
+
import { nodeImmutable, nodeProxy } from '../shadernode/ShaderNode.js';
|
|
3
|
+
import { cameraNear, cameraFar } from '../accessors/CameraNode.js';
|
|
4
|
+
import { positionView } from '../accessors/PositionNode.js';
|
|
5
|
+
import { viewportDepthTexture } from './ViewportDepthTextureNode.js';
|
|
6
|
+
|
|
7
|
+
class ViewportDepthNode extends Node {
|
|
8
|
+
|
|
9
|
+
constructor( scope, textureNode = null ) {
|
|
10
|
+
|
|
11
|
+
super( 'float' );
|
|
12
|
+
|
|
13
|
+
this.scope = scope;
|
|
14
|
+
this.textureNode = textureNode;
|
|
15
|
+
|
|
16
|
+
this.isViewportDepthNode = true;
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
construct( /*builder*/ ) {
|
|
21
|
+
|
|
22
|
+
const { scope } = this;
|
|
23
|
+
|
|
24
|
+
let node = null;
|
|
25
|
+
|
|
26
|
+
if ( scope === ViewportDepthNode.DEPTH ) {
|
|
27
|
+
|
|
28
|
+
node = viewZToOrthographicDepth( positionView.z, cameraNear, cameraFar );
|
|
29
|
+
|
|
30
|
+
} else if ( scope === ViewportDepthNode.DEPTH_TEXTURE ) {
|
|
31
|
+
|
|
32
|
+
const texture = this.textureNode || viewportDepthTexture();
|
|
33
|
+
|
|
34
|
+
const viewZ = perspectiveDepthToViewZ( texture, cameraNear, cameraFar );
|
|
35
|
+
node = viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return node;
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// NOTE: viewZ, the z-coordinate in camera space, is negative for points in front of the camera
|
|
46
|
+
|
|
47
|
+
// -near maps to 0; -far maps to 1
|
|
48
|
+
export const viewZToOrthographicDepth = ( viewZ, near, far ) => viewZ.add( near ).div( near.sub( far ) );
|
|
49
|
+
|
|
50
|
+
// maps orthographic depth in [ 0, 1 ] to viewZ
|
|
51
|
+
export const orthographicDepthToViewZ = ( depth, near, far ) => near.sub( far ).mul( depth ).sub( near );
|
|
52
|
+
|
|
53
|
+
// NOTE: https://twitter.com/gonnavis/status/1377183786949959682
|
|
54
|
+
|
|
55
|
+
// -near maps to 0; -far maps to 1
|
|
56
|
+
export const viewZToPerspectiveDepth = ( viewZ, near, far ) => near.add( viewZ ).mul( far ).div( near.sub( far ).mul( viewZ ) );
|
|
57
|
+
|
|
58
|
+
// maps perspective depth in [ 0, 1 ] to viewZ
|
|
59
|
+
export const perspectiveDepthToViewZ = ( depth, near, far ) => near.mul( far ).div( far.sub( near ).mul( depth ).sub( far ) );
|
|
60
|
+
|
|
61
|
+
ViewportDepthNode.DEPTH = 'depth';
|
|
62
|
+
ViewportDepthNode.DEPTH_TEXTURE = 'depthTexture';
|
|
63
|
+
|
|
64
|
+
export default ViewportDepthNode;
|
|
65
|
+
|
|
66
|
+
export const depth = nodeImmutable( ViewportDepthNode, ViewportDepthNode.DEPTH );
|
|
67
|
+
export const depthTexture = nodeProxy( ViewportDepthNode, ViewportDepthNode.DEPTH_TEXTURE );
|
|
68
|
+
|
|
69
|
+
addNodeClass( ViewportDepthNode );
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import ViewportTextureNode from './ViewportTextureNode.js';
|
|
2
|
+
import { addNodeClass } from '../core/Node.js';
|
|
3
|
+
import { addNodeElement, nodeProxy } from '../shadernode/ShaderNode.js';
|
|
4
|
+
import { viewportTopLeft } from './ViewportNode.js';
|
|
5
|
+
import { DepthTexture, LinearMipmapLinearFilter, DepthFormat, UnsignedIntType } from 'three';
|
|
6
|
+
|
|
7
|
+
let sharedDepthbuffer = null;
|
|
8
|
+
|
|
9
|
+
class ViewportDepthTextureNode extends ViewportTextureNode {
|
|
10
|
+
|
|
11
|
+
constructor( uvNode = viewportTopLeft, levelNode = null ) {
|
|
12
|
+
|
|
13
|
+
if ( sharedDepthbuffer === null ) {
|
|
14
|
+
|
|
15
|
+
sharedDepthbuffer = new DepthTexture();
|
|
16
|
+
sharedDepthbuffer.minFilter = LinearMipmapLinearFilter;
|
|
17
|
+
sharedDepthbuffer.type = UnsignedIntType;
|
|
18
|
+
sharedDepthbuffer.format = DepthFormat;
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
super( uvNode, levelNode, sharedDepthbuffer );
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default ViewportDepthTextureNode;
|
|
29
|
+
|
|
30
|
+
export const viewportDepthTexture = nodeProxy( ViewportDepthTextureNode );
|
|
31
|
+
|
|
32
|
+
addNodeElement( 'viewportDepthTexture', viewportDepthTexture );
|
|
33
|
+
|
|
34
|
+
addNodeClass( ViewportDepthTextureNode );
|
|
@@ -2,20 +2,21 @@ import ViewportTextureNode from './ViewportTextureNode.js';
|
|
|
2
2
|
import { addNodeClass } from '../core/Node.js';
|
|
3
3
|
import { addNodeElement, nodeProxy } from '../shadernode/ShaderNode.js';
|
|
4
4
|
import { viewportTopLeft } from './ViewportNode.js';
|
|
5
|
+
import { FramebufferTexture } from 'three';
|
|
5
6
|
|
|
6
7
|
let sharedFramebuffer = null;
|
|
7
8
|
|
|
8
9
|
class ViewportSharedTextureNode extends ViewportTextureNode {
|
|
9
10
|
|
|
10
|
-
constructor(
|
|
11
|
+
constructor( uvNode = viewportTopLeft, levelNode = null ) {
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
if ( sharedFramebuffer === null ) {
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
sharedFramebuffer = new FramebufferTexture();
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
}
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
super( uvNode, levelNode, sharedFramebuffer );
|
|
19
20
|
|
|
20
21
|
}
|
|
21
22
|
|
|
@@ -3,33 +3,28 @@ import { NodeUpdateType } from '../core/constants.js';
|
|
|
3
3
|
import { addNodeClass } from '../core/Node.js';
|
|
4
4
|
import { addNodeElement, nodeProxy } from '../shadernode/ShaderNode.js';
|
|
5
5
|
import { viewportTopLeft } from './ViewportNode.js';
|
|
6
|
-
import { Vector2, FramebufferTexture } from 'three';
|
|
6
|
+
import { Vector2, FramebufferTexture, LinearMipmapLinearFilter } from 'three';
|
|
7
7
|
|
|
8
8
|
const _size = new Vector2();
|
|
9
9
|
|
|
10
10
|
class ViewportTextureNode extends TextureNode {
|
|
11
11
|
|
|
12
|
-
constructor(
|
|
12
|
+
constructor( uvNode = viewportTopLeft, levelNode = null, framebufferTexture = null ) {
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
if ( framebufferTexture === null ) {
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
this.updateBeforeType = NodeUpdateType.FRAME;
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
constructFramebuffer( /*builder*/ ) {
|
|
16
|
+
framebufferTexture = new FramebufferTexture();
|
|
17
|
+
framebufferTexture.minFilter = LinearMipmapLinearFilter;
|
|
23
18
|
|
|
24
|
-
|
|
19
|
+
}
|
|
25
20
|
|
|
26
|
-
|
|
21
|
+
super( framebufferTexture, uvNode, levelNode );
|
|
27
22
|
|
|
28
|
-
|
|
23
|
+
this.generateMipmaps = false;
|
|
29
24
|
|
|
30
|
-
|
|
25
|
+
this.isOutputTextureNode = true;
|
|
31
26
|
|
|
32
|
-
|
|
27
|
+
this.updateBeforeType = NodeUpdateType.FRAME;
|
|
33
28
|
|
|
34
29
|
}
|
|
35
30
|
|
|
@@ -52,8 +47,19 @@ class ViewportTextureNode extends TextureNode {
|
|
|
52
47
|
|
|
53
48
|
//
|
|
54
49
|
|
|
50
|
+
const currentGenerateMipmaps = framebufferTexture.generateMipmaps;
|
|
51
|
+
framebufferTexture.generateMipmaps = this.generateMipmaps;
|
|
52
|
+
|
|
55
53
|
renderer.copyFramebufferToTexture( framebufferTexture );
|
|
56
54
|
|
|
55
|
+
framebufferTexture.generateMipmaps = currentGenerateMipmaps;
|
|
56
|
+
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
clone() {
|
|
60
|
+
|
|
61
|
+
return new this.constructor( this.uvNode, this.levelNode, this.value );
|
|
62
|
+
|
|
57
63
|
}
|
|
58
64
|
|
|
59
65
|
}
|
|
@@ -61,7 +67,9 @@ class ViewportTextureNode extends TextureNode {
|
|
|
61
67
|
export default ViewportTextureNode;
|
|
62
68
|
|
|
63
69
|
export const viewportTexture = nodeProxy( ViewportTextureNode );
|
|
70
|
+
export const viewportMipTexture = nodeProxy( ViewportTextureNode, null, null, { generateMipmaps: true } );
|
|
64
71
|
|
|
65
72
|
addNodeElement( 'viewportTexture', viewportTexture );
|
|
73
|
+
addNodeElement( 'viewportMipTexture', viewportMipTexture );
|
|
66
74
|
|
|
67
75
|
addNodeClass( ViewportTextureNode );
|