super-three 0.155.0 → 0.157.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 +361 -324
- package/build/three.js +361 -324
- package/build/three.min.js +2 -2
- package/build/three.module.js +354 -323
- package/build/three.module.min.js +1 -1
- package/examples/jsm/capabilities/WebGL.js +17 -0
- package/examples/jsm/controls/DragControls.js +3 -2
- package/examples/jsm/controls/OrbitControls.js +13 -5
- package/examples/jsm/csm/CSMShader.js +59 -21
- package/examples/jsm/exporters/EXRExporter.js +102 -24
- package/examples/jsm/exporters/GLTFExporter.js +1 -1
- package/examples/jsm/libs/rhino3dm/rhino3dm.js +8726 -4
- package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +8737 -4
- package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
- package/examples/jsm/libs/tween.module.js +790 -735
- package/examples/jsm/libs/utif.module.js +1644 -1558
- package/examples/jsm/lights/LightProbeGenerator.js +37 -3
- package/examples/jsm/lines/LineMaterial.js +90 -156
- package/examples/jsm/loaders/3DMLoader.js +378 -104
- package/examples/jsm/loaders/DDSLoader.js +46 -3
- package/examples/jsm/loaders/EXRLoader.js +4 -4
- package/examples/jsm/loaders/FBXLoader.js +2 -0
- package/examples/jsm/loaders/GLTFLoader.js +18 -8
- package/examples/jsm/loaders/KTX2Loader.js +126 -77
- package/examples/jsm/loaders/LDrawLoader.js +22 -16
- package/examples/jsm/loaders/LogLuvLoader.js +2 -2
- package/examples/jsm/loaders/MMDLoader.js +10 -7
- package/examples/jsm/loaders/RGBELoader.js +48 -66
- package/examples/jsm/loaders/STLLoader.js +7 -0
- package/examples/jsm/loaders/USDZLoader.js +215 -12
- package/examples/jsm/materials/MeshGouraudMaterial.js +22 -18
- package/examples/jsm/nodes/Nodes.js +8 -1
- package/examples/jsm/nodes/accessors/BitangentNode.js +1 -1
- package/examples/jsm/nodes/accessors/BufferAttributeNode.js +30 -4
- package/examples/jsm/nodes/accessors/BufferNode.js +1 -1
- package/examples/jsm/nodes/accessors/CameraNode.js +1 -1
- package/examples/jsm/nodes/accessors/CubeTextureNode.js +19 -4
- package/examples/jsm/nodes/accessors/ExtendedMaterialNode.js +4 -5
- package/examples/jsm/nodes/accessors/InstanceNode.js +2 -2
- package/examples/jsm/nodes/accessors/LineMaterialNode.js +29 -0
- package/examples/jsm/nodes/accessors/MaterialNode.js +23 -13
- package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +12 -9
- package/examples/jsm/nodes/accessors/ModelNode.js +1 -1
- package/examples/jsm/nodes/accessors/ModelViewProjectionNode.js +5 -4
- package/examples/jsm/nodes/accessors/MorphNode.js +4 -4
- package/examples/jsm/nodes/accessors/NormalNode.js +1 -1
- package/examples/jsm/nodes/accessors/Object3DNode.js +3 -3
- package/examples/jsm/nodes/accessors/PointUVNode.js +1 -1
- package/examples/jsm/nodes/accessors/PositionNode.js +1 -1
- package/examples/jsm/nodes/accessors/ReferenceNode.js +13 -7
- package/examples/jsm/nodes/accessors/ReflectVectorNode.js +2 -2
- package/examples/jsm/nodes/accessors/SceneNode.js +2 -2
- package/examples/jsm/nodes/accessors/SkinningNode.js +2 -2
- package/examples/jsm/nodes/accessors/StorageBufferNode.js +1 -1
- package/examples/jsm/nodes/accessors/TangentNode.js +1 -1
- package/examples/jsm/nodes/accessors/TextureBicubicNode.js +2 -2
- package/examples/jsm/nodes/accessors/TextureNode.js +18 -8
- package/examples/jsm/nodes/accessors/TextureSizeNode.js +2 -2
- package/examples/jsm/nodes/accessors/TextureStoreNode.js +29 -0
- package/examples/jsm/nodes/accessors/UVNode.js +1 -1
- package/examples/jsm/nodes/accessors/UserDataNode.js +2 -2
- package/examples/jsm/nodes/code/CodeNode.js +1 -1
- package/examples/jsm/nodes/code/ExpressionNode.js +1 -1
- package/examples/jsm/nodes/code/FunctionCallNode.js +1 -1
- package/examples/jsm/nodes/code/FunctionNode.js +18 -7
- package/examples/jsm/nodes/code/ScriptableNode.js +2 -2
- package/examples/jsm/nodes/code/ScriptableValueNode.js +2 -2
- package/examples/jsm/nodes/core/ArrayUniformNode.js +1 -1
- package/examples/jsm/nodes/core/AttributeNode.js +3 -3
- package/examples/jsm/nodes/core/BypassNode.js +1 -1
- package/examples/jsm/nodes/core/CacheNode.js +1 -1
- package/examples/jsm/nodes/core/ConstNode.js +1 -1
- package/examples/jsm/nodes/core/ContextNode.js +2 -2
- package/examples/jsm/nodes/core/IndexNode.js +1 -1
- package/examples/jsm/nodes/core/InputNode.js +1 -1
- package/examples/jsm/nodes/core/Node.js +45 -14
- package/examples/jsm/nodes/core/NodeBuilder.js +83 -15
- package/examples/jsm/nodes/core/NodeFrame.js +37 -14
- package/examples/jsm/nodes/core/NodeUniform.js +1 -1
- package/examples/jsm/nodes/core/OutputStructNode.js +62 -0
- package/examples/jsm/nodes/core/PropertyNode.js +3 -1
- package/examples/jsm/nodes/core/StackNode.js +5 -5
- package/examples/jsm/nodes/core/StructTypeNode.js +24 -0
- package/examples/jsm/nodes/core/TempNode.js +1 -1
- package/examples/jsm/nodes/core/UniformNode.js +3 -1
- package/examples/jsm/nodes/core/VarNode.js +1 -1
- package/examples/jsm/nodes/core/VaryingNode.js +1 -1
- package/examples/jsm/nodes/core/constants.js +1 -1
- package/examples/jsm/nodes/display/BlendModeNode.js +2 -2
- package/examples/jsm/nodes/display/BumpMapNode.js +2 -2
- package/examples/jsm/nodes/display/ColorAdjustmentNode.js +2 -2
- package/examples/jsm/nodes/display/ColorSpaceNode.js +2 -2
- package/examples/jsm/nodes/display/FrontFacingNode.js +1 -1
- package/examples/jsm/nodes/display/NormalMapNode.js +2 -2
- package/examples/jsm/nodes/display/PosterizeNode.js +2 -2
- package/examples/jsm/nodes/display/ToneMappingNode.js +2 -2
- package/examples/jsm/nodes/display/ViewportDepthNode.js +2 -2
- package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +1 -1
- package/examples/jsm/nodes/display/ViewportNode.js +21 -7
- package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +1 -1
- package/examples/jsm/nodes/display/ViewportTextureNode.js +1 -1
- package/examples/jsm/nodes/fog/FogExp2Node.js +2 -2
- package/examples/jsm/nodes/fog/FogNode.js +2 -2
- package/examples/jsm/nodes/fog/FogRangeNode.js +2 -2
- package/examples/jsm/nodes/geometry/RangeNode.js +2 -2
- package/examples/jsm/nodes/gpgpu/ComputeNode.js +1 -1
- package/examples/jsm/nodes/lighting/AONode.js +2 -2
- package/examples/jsm/nodes/lighting/AmbientLightNode.js +3 -3
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +4 -4
- package/examples/jsm/nodes/lighting/DirectionalLightNode.js +4 -4
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +2 -2
- package/examples/jsm/nodes/lighting/HemisphereLightNode.js +3 -3
- package/examples/jsm/nodes/lighting/IESSpotLightNode.js +2 -2
- package/examples/jsm/nodes/lighting/LightNode.js +2 -2
- package/examples/jsm/nodes/lighting/LightingContextNode.js +3 -3
- package/examples/jsm/nodes/lighting/LightingNode.js +1 -1
- package/examples/jsm/nodes/lighting/LightsNode.js +4 -4
- package/examples/jsm/nodes/lighting/PointLightNode.js +3 -3
- package/examples/jsm/nodes/lighting/SpotLightNode.js +4 -4
- package/examples/jsm/nodes/materials/Line2NodeMaterial.js +449 -0
- package/examples/jsm/nodes/materials/LineBasicNodeMaterial.js +1 -1
- package/examples/jsm/nodes/materials/LineDashedNodeMaterial.js +54 -0
- package/examples/jsm/nodes/materials/Materials.js +2 -0
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +1 -1
- package/examples/jsm/nodes/materials/MeshLambertNodeMaterial.js +2 -2
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +2 -2
- package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +3 -3
- package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +6 -6
- package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +3 -3
- package/examples/jsm/nodes/materials/NodeMaterial.js +39 -29
- package/examples/jsm/nodes/materials/PointsNodeMaterial.js +1 -1
- package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +2 -2
- package/examples/jsm/nodes/math/CondNode.js +1 -1
- package/examples/jsm/nodes/math/HashNode.js +34 -0
- package/examples/jsm/nodes/math/MathNode.js +2 -2
- 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 +85 -28
- package/examples/jsm/nodes/utils/ArrayElementNode.js +1 -1
- package/examples/jsm/nodes/utils/ConvertNode.js +1 -1
- package/examples/jsm/nodes/utils/DiscardNode.js +1 -1
- package/examples/jsm/nodes/utils/EquirectUVNode.js +2 -2
- package/examples/jsm/nodes/utils/JoinNode.js +1 -1
- package/examples/jsm/nodes/utils/LoopNode.js +11 -11
- package/examples/jsm/nodes/utils/MatcapUVNode.js +2 -2
- package/examples/jsm/nodes/utils/MaxMipLevelNode.js +1 -1
- package/examples/jsm/nodes/utils/OscNode.js +2 -2
- package/examples/jsm/nodes/utils/PackingNode.js +2 -2
- package/examples/jsm/nodes/utils/RemapNode.js +2 -2
- package/examples/jsm/nodes/utils/RotateUVNode.js +2 -2
- package/examples/jsm/nodes/utils/SetNode.js +62 -0
- package/examples/jsm/nodes/utils/SpecularMIPLevelNode.js +2 -2
- package/examples/jsm/nodes/utils/SplitNode.js +2 -2
- package/examples/jsm/nodes/utils/SpriteSheetUVNode.js +2 -2
- package/examples/jsm/nodes/utils/TimerNode.js +2 -2
- package/examples/jsm/nodes/utils/TriplanarTexturesNode.js +2 -2
- package/examples/jsm/objects/Sky.js +1 -3
- package/examples/jsm/postprocessing/FilmPass.js +3 -5
- package/examples/jsm/postprocessing/OutputPass.js +3 -2
- package/examples/jsm/postprocessing/RenderPass.js +30 -12
- package/examples/jsm/postprocessing/SAOPass.js +23 -98
- package/examples/jsm/postprocessing/SSAOPass.js +10 -30
- package/examples/jsm/renderers/common/Backend.js +11 -8
- package/examples/jsm/renderers/common/Background.js +2 -2
- package/examples/jsm/renderers/common/Binding.js +6 -0
- package/examples/jsm/renderers/common/Bindings.js +4 -5
- package/examples/jsm/renderers/common/Pipelines.js +9 -9
- package/examples/jsm/renderers/common/RenderContext.js +3 -0
- package/examples/jsm/renderers/common/RenderContexts.js +26 -1
- package/examples/jsm/renderers/common/RenderList.js +12 -4
- package/examples/jsm/renderers/common/RenderObject.js +43 -15
- package/examples/jsm/renderers/common/RenderObjects.js +8 -14
- package/examples/jsm/renderers/common/Renderer.js +52 -16
- package/examples/jsm/renderers/common/SampledTexture.js +6 -3
- package/examples/jsm/renderers/common/Sampler.js +1 -1
- package/examples/jsm/renderers/common/StorageBuffer.js +1 -1
- package/examples/jsm/renderers/common/StorageTexture.js +19 -0
- package/examples/jsm/renderers/common/Textures.js +166 -21
- package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +35 -0
- package/examples/jsm/renderers/common/nodes/NodeSampledTexture.js +21 -11
- package/examples/jsm/renderers/common/nodes/NodeSampler.js +1 -7
- package/examples/jsm/renderers/common/nodes/Nodes.js +79 -18
- package/examples/jsm/renderers/webgl/WebGLBackend.js +702 -0
- package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +207 -20
- package/examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js +84 -0
- package/examples/jsm/renderers/webgl/utils/WebGLExtensions.js +26 -0
- package/examples/jsm/renderers/webgl/utils/WebGLState.js +529 -0
- package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +212 -0
- package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +242 -0
- package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +340 -0
- package/examples/jsm/renderers/{webgl → webgl-legacy}/nodes/WebGLNodeBuilder.js +4 -4
- package/examples/jsm/renderers/{webgl → webgl-legacy}/nodes/WebGLNodes.js +14 -2
- package/examples/jsm/renderers/webgpu/WebGPUBackend.js +282 -43
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +18 -2
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +93 -60
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeFunction.js +2 -2
- package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +15 -2
- package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +39 -14
- package/examples/jsm/renderers/webgpu/utils/WebGPUTexturePassUtils.js +285 -0
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +205 -284
- package/examples/jsm/renderers/webgpu/utils/WebGPUUtils.js +6 -5
- package/examples/jsm/shaders/FilmShader.js +11 -54
- package/examples/jsm/shaders/GammaCorrectionShader.js +1 -1
- package/examples/jsm/shaders/MMDToonShader.js +4 -4
- package/examples/jsm/shaders/OutputShader.js +2 -2
- package/examples/jsm/shaders/SAOShader.js +0 -13
- package/examples/jsm/shaders/SSAOShader.js +33 -26
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +6 -6
- package/examples/jsm/utils/BufferGeometryUtils.js +6 -4
- package/package.json +1 -1
- package/src/Three.js +1 -2
- package/src/animation/AnimationUtils.js +3 -20
- package/src/animation/KeyframeTrack.js +8 -8
- package/src/audio/Audio.js +6 -0
- package/src/cameras/Camera.js +1 -5
- package/src/cameras/CubeCamera.js +14 -8
- package/src/constants.js +10 -1
- package/src/core/Object3D.js +1 -14
- package/src/core/RenderTarget.js +16 -7
- package/src/core/UniformsGroup.js +2 -2
- package/src/extras/core/CurvePath.js +4 -1
- package/src/loaders/DataTextureLoader.js +0 -2
- package/src/loaders/MaterialLoader.js +1 -1
- package/src/loaders/ObjectLoader.js +6 -0
- package/src/materials/Material.js +10 -10
- package/src/math/Color.js +1 -5
- package/src/math/ColorManagement.js +82 -60
- package/src/math/Vector2.js +2 -2
- package/src/math/Vector3.js +3 -3
- package/src/math/Vector4.js +4 -4
- package/src/objects/Line.js +1 -1
- package/src/objects/Mesh.js +1 -1
- package/src/objects/Points.js +1 -1
- package/src/objects/Sprite.js +2 -2
- package/src/renderers/WebGLRenderer.js +42 -51
- package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +35 -2
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -9
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +19 -15
- package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +4 -4
- package/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.js +3 -3
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +11 -6
- package/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.js +4 -4
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +16 -16
- package/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.js +3 -3
- package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +11 -1
- package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/background.glsl.js +8 -0
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +1 -1
- package/src/renderers/shaders/UniformsUtils.js +2 -2
- package/src/renderers/webgl/WebGLBackground.js +9 -17
- package/src/renderers/webgl/WebGLLights.js +14 -3
- package/src/renderers/webgl/WebGLProgram.js +36 -5
- package/src/renderers/webgl/WebGLPrograms.js +9 -1
- package/src/renderers/webgl/WebGLTextures.js +19 -8
- package/src/renderers/webgl/WebGLUtils.js +25 -20
- package/src/scenes/Fog.js +1 -0
- package/src/scenes/FogExp2.js +1 -0
- package/src/textures/Source.js +2 -2
- package/src/textures/Texture.js +2 -2
- package/src/utils.js +9 -1
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureMipmapUtils.js +0 -163
- package/src/lights/AmbientLightProbe.js +0 -21
- package/src/lights/HemisphereLightProbe.js +0 -30
- /package/examples/jsm/renderers/{webgl → webgl-legacy}/nodes/SlotNode.js +0 -0
|
@@ -17,7 +17,7 @@ class RemapNode extends Node {
|
|
|
17
17
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
setup() {
|
|
21
21
|
|
|
22
22
|
const { node, inLowNode, inHighNode, outLowNode, outHighNode, doClamp } = this;
|
|
23
23
|
|
|
@@ -39,4 +39,4 @@ export const remapClamp = nodeProxy( RemapNode );
|
|
|
39
39
|
addNodeElement( 'remap', remap );
|
|
40
40
|
addNodeElement( 'remapClamp', remapClamp );
|
|
41
41
|
|
|
42
|
-
addNodeClass( RemapNode );
|
|
42
|
+
addNodeClass( 'RemapNode', RemapNode );
|
|
@@ -14,7 +14,7 @@ class RotateUVNode extends TempNode {
|
|
|
14
14
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
setup() {
|
|
18
18
|
|
|
19
19
|
const { uvNode, rotationNode, centerNode } = this;
|
|
20
20
|
|
|
@@ -40,4 +40,4 @@ export const rotateUV = nodeProxy( RotateUVNode );
|
|
|
40
40
|
|
|
41
41
|
addNodeElement( 'rotateUV', rotateUV );
|
|
42
42
|
|
|
43
|
-
addNodeClass( RotateUVNode );
|
|
43
|
+
addNodeClass( 'RotateUVNode', RotateUVNode );
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { addNodeClass } from '../core/Node.js';
|
|
2
|
+
import TempNode from '../core/TempNode.js';
|
|
3
|
+
import { vectorComponents } from '../core/constants.js';
|
|
4
|
+
|
|
5
|
+
class SetNode extends TempNode {
|
|
6
|
+
|
|
7
|
+
constructor( sourceNode, components, targetNode ) {
|
|
8
|
+
|
|
9
|
+
super();
|
|
10
|
+
|
|
11
|
+
this.sourceNode = sourceNode;
|
|
12
|
+
this.components = components;
|
|
13
|
+
this.targetNode = targetNode;
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getNodeType( builder ) {
|
|
18
|
+
|
|
19
|
+
return this.sourceNode.getNodeType( builder );
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
generate( builder ) {
|
|
24
|
+
|
|
25
|
+
const { sourceNode, components, targetNode } = this;
|
|
26
|
+
|
|
27
|
+
const sourceType = this.getNodeType( builder );
|
|
28
|
+
const targetType = builder.getTypeFromLength( components.length );
|
|
29
|
+
|
|
30
|
+
const targetSnippet = targetNode.build( builder, targetType );
|
|
31
|
+
const sourceSnippet = sourceNode.build( builder, sourceType );
|
|
32
|
+
|
|
33
|
+
const length = builder.getTypeLength( sourceType );
|
|
34
|
+
const snippetValues = [];
|
|
35
|
+
|
|
36
|
+
for ( let i = 0; i < length; i ++ ) {
|
|
37
|
+
|
|
38
|
+
const component = vectorComponents[ i ];
|
|
39
|
+
|
|
40
|
+
if ( component === components[ 0 ] ) {
|
|
41
|
+
|
|
42
|
+
snippetValues.push( targetSnippet );
|
|
43
|
+
|
|
44
|
+
i += components.length - 1;
|
|
45
|
+
|
|
46
|
+
} else {
|
|
47
|
+
|
|
48
|
+
snippetValues.push( sourceSnippet + '.' + component );
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return `${ builder.getType( sourceType ) }( ${ snippetValues.join( ', ' ) } )`;
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export default SetNode;
|
|
61
|
+
|
|
62
|
+
addNodeClass( 'SetNode', SetNode );
|
|
@@ -13,7 +13,7 @@ class SpecularMIPLevelNode extends Node {
|
|
|
13
13
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
setup() {
|
|
17
17
|
|
|
18
18
|
const { textureNode, roughnessNode } = this;
|
|
19
19
|
|
|
@@ -34,4 +34,4 @@ export default SpecularMIPLevelNode;
|
|
|
34
34
|
|
|
35
35
|
export const specularMIPLevel = nodeProxy( SpecularMIPLevelNode );
|
|
36
36
|
|
|
37
|
-
addNodeClass( SpecularMIPLevelNode );
|
|
37
|
+
addNodeClass( 'SpecularMIPLevelNode', SpecularMIPLevelNode );
|
|
@@ -59,7 +59,7 @@ class SplitNode extends Node {
|
|
|
59
59
|
|
|
60
60
|
if ( this.components.length === nodeTypeLength && this.components === stringVectorComponents.slice( 0, this.components.length ) ) {
|
|
61
61
|
|
|
62
|
-
//
|
|
62
|
+
// unnecessary swizzle
|
|
63
63
|
|
|
64
64
|
snippet = builder.format( nodeSnippet, type, output );
|
|
65
65
|
|
|
@@ -101,4 +101,4 @@ class SplitNode extends Node {
|
|
|
101
101
|
|
|
102
102
|
export default SplitNode;
|
|
103
103
|
|
|
104
|
-
addNodeClass( SplitNode );
|
|
104
|
+
addNodeClass( 'SplitNode', SplitNode );
|
|
@@ -14,7 +14,7 @@ class SpriteSheetUVNode extends Node {
|
|
|
14
14
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
setup() {
|
|
18
18
|
|
|
19
19
|
const { frameNode, uvNode, countNode } = this;
|
|
20
20
|
|
|
@@ -38,4 +38,4 @@ export default SpriteSheetUVNode;
|
|
|
38
38
|
|
|
39
39
|
export const spritesheetUV = nodeProxy( SpriteSheetUVNode );
|
|
40
40
|
|
|
41
|
-
addNodeClass( SpriteSheetUVNode );
|
|
41
|
+
addNodeClass( 'SpriteSheetUVNode', SpriteSheetUVNode );
|
|
@@ -89,6 +89,6 @@ export default TimerNode;
|
|
|
89
89
|
export const timerLocal = ( timeScale, value = 0 ) => nodeObject( new TimerNode( TimerNode.LOCAL, timeScale, value ) );
|
|
90
90
|
export const timerGlobal = ( timeScale, value = 0 ) => nodeObject( new TimerNode( TimerNode.GLOBAL, timeScale, value ) );
|
|
91
91
|
export const timerDelta = ( timeScale, value = 0 ) => nodeObject( new TimerNode( TimerNode.DELTA, timeScale, value ) );
|
|
92
|
-
export const frameId = nodeImmutable( TimerNode, TimerNode.FRAME );
|
|
92
|
+
export const frameId = nodeImmutable( TimerNode, TimerNode.FRAME ).uint();
|
|
93
93
|
|
|
94
|
-
addNodeClass( TimerNode );
|
|
94
|
+
addNodeClass( 'TimerNode', TimerNode );
|
|
@@ -22,7 +22,7 @@ class TriplanarTexturesNode extends Node {
|
|
|
22
22
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
setup() {
|
|
26
26
|
|
|
27
27
|
const { textureXNode, textureYNode, textureZNode, scaleNode, positionNode, normalNode } = this;
|
|
28
28
|
|
|
@@ -59,4 +59,4 @@ export const triplanarTexture = ( ...params ) => triplanarTextures( ...params );
|
|
|
59
59
|
|
|
60
60
|
addNodeElement( 'triplanarTexture', triplanarTexture );
|
|
61
61
|
|
|
62
|
-
addNodeClass( TriplanarTexturesNode );
|
|
62
|
+
addNodeClass( 'TriplanarTexturesNode', TriplanarTexturesNode );
|
|
@@ -138,8 +138,6 @@ Sky.SkyShader = {
|
|
|
138
138
|
uniform float mieDirectionalG;
|
|
139
139
|
uniform vec3 up;
|
|
140
140
|
|
|
141
|
-
const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );
|
|
142
|
-
|
|
143
141
|
// constants for atmospheric scattering
|
|
144
142
|
const float pi = 3.141592653589793238462643383279502884197169;
|
|
145
143
|
|
|
@@ -169,7 +167,7 @@ Sky.SkyShader = {
|
|
|
169
167
|
|
|
170
168
|
void main() {
|
|
171
169
|
|
|
172
|
-
vec3 direction = normalize( vWorldPosition -
|
|
170
|
+
vec3 direction = normalize( vWorldPosition - cameraPosition );
|
|
173
171
|
|
|
174
172
|
// optical length
|
|
175
173
|
// cutoff angle at 90 to avoid singularity in next formula.
|
|
@@ -7,7 +7,7 @@ import { FilmShader } from '../shaders/FilmShader.js';
|
|
|
7
7
|
|
|
8
8
|
class FilmPass extends Pass {
|
|
9
9
|
|
|
10
|
-
constructor(
|
|
10
|
+
constructor( intensity = 0.5, grayscale = false ) {
|
|
11
11
|
|
|
12
12
|
super();
|
|
13
13
|
|
|
@@ -24,10 +24,8 @@ class FilmPass extends Pass {
|
|
|
24
24
|
|
|
25
25
|
} );
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if ( scanlinesIntensity !== undefined ) this.uniforms.sIntensity.value = scanlinesIntensity;
|
|
30
|
-
if ( scanlinesCount !== undefined ) this.uniforms.sCount.value = scanlinesCount;
|
|
27
|
+
this.uniforms.intensity.value = intensity; // (0 = no effect, 1 = full effect)
|
|
28
|
+
this.uniforms.grayscale.value = grayscale;
|
|
31
29
|
|
|
32
30
|
this.fsQuad = new FullScreenQuad( this.material );
|
|
33
31
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ColorManagement,
|
|
2
3
|
RawShaderMaterial,
|
|
3
4
|
UniformsUtils,
|
|
4
5
|
LinearToneMapping,
|
|
5
6
|
ReinhardToneMapping,
|
|
6
7
|
CineonToneMapping,
|
|
7
8
|
ACESFilmicToneMapping,
|
|
8
|
-
|
|
9
|
+
SRGBTransfer
|
|
9
10
|
} from 'three';
|
|
10
11
|
import { Pass, FullScreenQuad } from './Pass.js';
|
|
11
12
|
import { OutputShader } from '../shaders/OutputShader.js';
|
|
@@ -51,7 +52,7 @@ class OutputPass extends Pass {
|
|
|
51
52
|
|
|
52
53
|
this.material.defines = {};
|
|
53
54
|
|
|
54
|
-
if ( this._outputColorSpace
|
|
55
|
+
if ( ColorManagement.getTransfer( this._outputColorSpace ) === SRGBTransfer ) this.material.defines.SRGB_TRANSFER = '';
|
|
55
56
|
|
|
56
57
|
if ( this._toneMapping === LinearToneMapping ) this.material.defines.LINEAR_TONE_MAPPING = '';
|
|
57
58
|
else if ( this._toneMapping === ReinhardToneMapping ) this.material.defines.REINHARD_TONE_MAPPING = '';
|
|
@@ -5,7 +5,7 @@ import { Pass } from './Pass.js';
|
|
|
5
5
|
|
|
6
6
|
class RenderPass extends Pass {
|
|
7
7
|
|
|
8
|
-
constructor( scene, camera, overrideMaterial, clearColor, clearAlpha ) {
|
|
8
|
+
constructor( scene, camera, overrideMaterial = null, clearColor = null, clearAlpha = null ) {
|
|
9
9
|
|
|
10
10
|
super();
|
|
11
11
|
|
|
@@ -15,7 +15,7 @@ class RenderPass extends Pass {
|
|
|
15
15
|
this.overrideMaterial = overrideMaterial;
|
|
16
16
|
|
|
17
17
|
this.clearColor = clearColor;
|
|
18
|
-
this.clearAlpha =
|
|
18
|
+
this.clearAlpha = clearAlpha;
|
|
19
19
|
|
|
20
20
|
this.clear = true;
|
|
21
21
|
this.clearDepth = false;
|
|
@@ -31,7 +31,7 @@ class RenderPass extends Pass {
|
|
|
31
31
|
|
|
32
32
|
let oldClearAlpha, oldOverrideMaterial;
|
|
33
33
|
|
|
34
|
-
if ( this.overrideMaterial !==
|
|
34
|
+
if ( this.overrideMaterial !== null ) {
|
|
35
35
|
|
|
36
36
|
oldOverrideMaterial = this.scene.overrideMaterial;
|
|
37
37
|
|
|
@@ -39,16 +39,21 @@ class RenderPass extends Pass {
|
|
|
39
39
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
if ( this.clearColor ) {
|
|
42
|
+
if ( this.clearColor !== null ) {
|
|
43
43
|
|
|
44
44
|
renderer.getClearColor( this._oldClearColor );
|
|
45
|
-
|
|
45
|
+
renderer.setClearColor( this.clearColor );
|
|
46
|
+
|
|
47
|
+
}
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
if ( this.clearAlpha !== null ) {
|
|
50
|
+
|
|
51
|
+
oldClearAlpha = renderer.getClearAlpha();
|
|
52
|
+
renderer.setClearAlpha( this.clearAlpha );
|
|
48
53
|
|
|
49
54
|
}
|
|
50
55
|
|
|
51
|
-
if ( this.clearDepth ) {
|
|
56
|
+
if ( this.clearDepth == true ) {
|
|
52
57
|
|
|
53
58
|
renderer.clearDepth();
|
|
54
59
|
|
|
@@ -56,17 +61,30 @@ class RenderPass extends Pass {
|
|
|
56
61
|
|
|
57
62
|
renderer.setRenderTarget( this.renderToScreen ? null : readBuffer );
|
|
58
63
|
|
|
59
|
-
|
|
60
|
-
|
|
64
|
+
if ( this.clear === true ) {
|
|
65
|
+
|
|
66
|
+
// TODO: Avoid using autoClear properties, see https://github.com/mrdoob/three.js/pull/15571#issuecomment-465669600
|
|
67
|
+
renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
|
|
61
71
|
renderer.render( this.scene, this.camera );
|
|
62
72
|
|
|
63
|
-
|
|
73
|
+
// restore
|
|
74
|
+
|
|
75
|
+
if ( this.clearColor !== null ) {
|
|
76
|
+
|
|
77
|
+
renderer.setClearColor( this._oldClearColor );
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if ( this.clearAlpha !== null ) {
|
|
64
82
|
|
|
65
|
-
renderer.
|
|
83
|
+
renderer.setClearAlpha( oldClearAlpha );
|
|
66
84
|
|
|
67
85
|
}
|
|
68
86
|
|
|
69
|
-
if ( this.overrideMaterial !==
|
|
87
|
+
if ( this.overrideMaterial !== null ) {
|
|
70
88
|
|
|
71
89
|
this.scene.overrideMaterial = oldOverrideMaterial;
|
|
72
90
|
|
|
@@ -6,14 +6,13 @@ import {
|
|
|
6
6
|
DstAlphaFactor,
|
|
7
7
|
DstColorFactor,
|
|
8
8
|
HalfFloatType,
|
|
9
|
-
MeshDepthMaterial,
|
|
10
9
|
MeshNormalMaterial,
|
|
11
10
|
NearestFilter,
|
|
12
11
|
NoBlending,
|
|
13
|
-
RGBADepthPacking,
|
|
14
12
|
ShaderMaterial,
|
|
15
13
|
UniformsUtils,
|
|
16
|
-
|
|
14
|
+
DepthStencilFormat,
|
|
15
|
+
UnsignedInt248Type,
|
|
17
16
|
Vector2,
|
|
18
17
|
WebGLRenderTarget,
|
|
19
18
|
ZeroFactor
|
|
@@ -23,7 +22,6 @@ import { SAOShader } from '../shaders/SAOShader.js';
|
|
|
23
22
|
import { DepthLimitedBlurShader } from '../shaders/DepthLimitedBlurShader.js';
|
|
24
23
|
import { BlurShaderUtils } from '../shaders/DepthLimitedBlurShader.js';
|
|
25
24
|
import { CopyShader } from '../shaders/CopyShader.js';
|
|
26
|
-
import { UnpackDepthRGBAShader } from '../shaders/UnpackDepthRGBAShader.js';
|
|
27
25
|
|
|
28
26
|
/**
|
|
29
27
|
* SAO implementation inspired from bhouston previous SAO work
|
|
@@ -31,7 +29,7 @@ import { UnpackDepthRGBAShader } from '../shaders/UnpackDepthRGBAShader.js';
|
|
|
31
29
|
|
|
32
30
|
class SAOPass extends Pass {
|
|
33
31
|
|
|
34
|
-
constructor( scene, camera,
|
|
32
|
+
constructor( scene, camera, resolution = new Vector2( 256, 256 ) ) {
|
|
35
33
|
|
|
36
34
|
super();
|
|
37
35
|
|
|
@@ -41,9 +39,6 @@ class SAOPass extends Pass {
|
|
|
41
39
|
this.clear = true;
|
|
42
40
|
this.needsSwap = false;
|
|
43
41
|
|
|
44
|
-
this.supportsDepthTextureExtension = useDepthTexture;
|
|
45
|
-
this.supportsNormalTexture = useNormals;
|
|
46
|
-
|
|
47
42
|
this.originalClearColor = new Color();
|
|
48
43
|
this._oldClearColor = new Color();
|
|
49
44
|
this.oldClearAlpha = 1;
|
|
@@ -65,30 +60,17 @@ class SAOPass extends Pass {
|
|
|
65
60
|
|
|
66
61
|
this.saoRenderTarget = new WebGLRenderTarget( this.resolution.x, this.resolution.y, { type: HalfFloatType } );
|
|
67
62
|
this.blurIntermediateRenderTarget = this.saoRenderTarget.clone();
|
|
68
|
-
|
|
63
|
+
|
|
64
|
+
const depthTexture = new DepthTexture();
|
|
65
|
+
depthTexture.format = DepthStencilFormat;
|
|
66
|
+
depthTexture.type = UnsignedInt248Type;
|
|
69
67
|
|
|
70
68
|
this.normalRenderTarget = new WebGLRenderTarget( this.resolution.x, this.resolution.y, {
|
|
71
69
|
minFilter: NearestFilter,
|
|
72
70
|
magFilter: NearestFilter,
|
|
73
|
-
type: HalfFloatType
|
|
71
|
+
type: HalfFloatType,
|
|
72
|
+
depthTexture: depthTexture
|
|
74
73
|
} );
|
|
75
|
-
this.depthRenderTarget = this.normalRenderTarget.clone();
|
|
76
|
-
|
|
77
|
-
let depthTexture;
|
|
78
|
-
|
|
79
|
-
if ( this.supportsDepthTextureExtension ) {
|
|
80
|
-
|
|
81
|
-
depthTexture = new DepthTexture();
|
|
82
|
-
depthTexture.type = UnsignedShortType;
|
|
83
|
-
|
|
84
|
-
this.beautyRenderTarget.depthTexture = depthTexture;
|
|
85
|
-
this.beautyRenderTarget.depthBuffer = true;
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
this.depthMaterial = new MeshDepthMaterial();
|
|
90
|
-
this.depthMaterial.depthPacking = RGBADepthPacking;
|
|
91
|
-
this.depthMaterial.blending = NoBlending;
|
|
92
74
|
|
|
93
75
|
this.normalMaterial = new MeshNormalMaterial();
|
|
94
76
|
this.normalMaterial.blending = NoBlending;
|
|
@@ -100,10 +82,8 @@ class SAOPass extends Pass {
|
|
|
100
82
|
uniforms: UniformsUtils.clone( SAOShader.uniforms )
|
|
101
83
|
} );
|
|
102
84
|
this.saoMaterial.extensions.derivatives = true;
|
|
103
|
-
this.saoMaterial.defines[ 'DEPTH_PACKING' ] = this.supportsDepthTextureExtension ? 0 : 1;
|
|
104
|
-
this.saoMaterial.defines[ 'NORMAL_TEXTURE' ] = this.supportsNormalTexture ? 1 : 0;
|
|
105
85
|
this.saoMaterial.defines[ 'PERSPECTIVE_CAMERA' ] = this.camera.isPerspectiveCamera ? 1 : 0;
|
|
106
|
-
this.saoMaterial.uniforms[ 'tDepth' ].value =
|
|
86
|
+
this.saoMaterial.uniforms[ 'tDepth' ].value = depthTexture;
|
|
107
87
|
this.saoMaterial.uniforms[ 'tNormal' ].value = this.normalRenderTarget.texture;
|
|
108
88
|
this.saoMaterial.uniforms[ 'size' ].value.set( this.resolution.x, this.resolution.y );
|
|
109
89
|
this.saoMaterial.uniforms[ 'cameraInverseProjectionMatrix' ].value.copy( this.camera.projectionMatrixInverse );
|
|
@@ -116,10 +96,10 @@ class SAOPass extends Pass {
|
|
|
116
96
|
vertexShader: DepthLimitedBlurShader.vertexShader,
|
|
117
97
|
fragmentShader: DepthLimitedBlurShader.fragmentShader
|
|
118
98
|
} );
|
|
119
|
-
this.vBlurMaterial.defines[ 'DEPTH_PACKING' ] =
|
|
99
|
+
this.vBlurMaterial.defines[ 'DEPTH_PACKING' ] = 0;
|
|
120
100
|
this.vBlurMaterial.defines[ 'PERSPECTIVE_CAMERA' ] = this.camera.isPerspectiveCamera ? 1 : 0;
|
|
121
101
|
this.vBlurMaterial.uniforms[ 'tDiffuse' ].value = this.saoRenderTarget.texture;
|
|
122
|
-
this.vBlurMaterial.uniforms[ 'tDepth' ].value =
|
|
102
|
+
this.vBlurMaterial.uniforms[ 'tDepth' ].value = depthTexture;
|
|
123
103
|
this.vBlurMaterial.uniforms[ 'size' ].value.set( this.resolution.x, this.resolution.y );
|
|
124
104
|
this.vBlurMaterial.blending = NoBlending;
|
|
125
105
|
|
|
@@ -129,10 +109,10 @@ class SAOPass extends Pass {
|
|
|
129
109
|
vertexShader: DepthLimitedBlurShader.vertexShader,
|
|
130
110
|
fragmentShader: DepthLimitedBlurShader.fragmentShader
|
|
131
111
|
} );
|
|
132
|
-
this.hBlurMaterial.defines[ 'DEPTH_PACKING' ] =
|
|
112
|
+
this.hBlurMaterial.defines[ 'DEPTH_PACKING' ] = 0;
|
|
133
113
|
this.hBlurMaterial.defines[ 'PERSPECTIVE_CAMERA' ] = this.camera.isPerspectiveCamera ? 1 : 0;
|
|
134
114
|
this.hBlurMaterial.uniforms[ 'tDiffuse' ].value = this.blurIntermediateRenderTarget.texture;
|
|
135
|
-
this.hBlurMaterial.uniforms[ 'tDepth' ].value =
|
|
115
|
+
this.hBlurMaterial.uniforms[ 'tDepth' ].value = depthTexture;
|
|
136
116
|
this.hBlurMaterial.uniforms[ 'size' ].value.set( this.resolution.x, this.resolution.y );
|
|
137
117
|
this.hBlurMaterial.blending = NoBlending;
|
|
138
118
|
|
|
@@ -153,13 +133,6 @@ class SAOPass extends Pass {
|
|
|
153
133
|
this.materialCopy.blendDstAlpha = ZeroFactor;
|
|
154
134
|
this.materialCopy.blendEquationAlpha = AddEquation;
|
|
155
135
|
|
|
156
|
-
this.depthCopy = new ShaderMaterial( {
|
|
157
|
-
uniforms: UniformsUtils.clone( UnpackDepthRGBAShader.uniforms ),
|
|
158
|
-
vertexShader: UnpackDepthRGBAShader.vertexShader,
|
|
159
|
-
fragmentShader: UnpackDepthRGBAShader.fragmentShader,
|
|
160
|
-
blending: NoBlending
|
|
161
|
-
} );
|
|
162
|
-
|
|
163
136
|
this.fsQuad = new FullScreenQuad( null );
|
|
164
137
|
|
|
165
138
|
}
|
|
@@ -176,20 +149,11 @@ class SAOPass extends Pass {
|
|
|
176
149
|
|
|
177
150
|
}
|
|
178
151
|
|
|
179
|
-
if ( this.params.output === 1 ) {
|
|
180
|
-
|
|
181
|
-
return;
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
185
152
|
renderer.getClearColor( this._oldClearColor );
|
|
186
153
|
this.oldClearAlpha = renderer.getClearAlpha();
|
|
187
154
|
const oldAutoClear = renderer.autoClear;
|
|
188
155
|
renderer.autoClear = false;
|
|
189
156
|
|
|
190
|
-
renderer.setRenderTarget( this.depthRenderTarget );
|
|
191
|
-
renderer.clear();
|
|
192
|
-
|
|
193
157
|
this.saoMaterial.uniforms[ 'bias' ].value = this.params.saoBias;
|
|
194
158
|
this.saoMaterial.uniforms[ 'intensity' ].value = this.params.saoIntensity;
|
|
195
159
|
this.saoMaterial.uniforms[ 'scale' ].value = this.params.saoScale;
|
|
@@ -218,26 +182,8 @@ class SAOPass extends Pass {
|
|
|
218
182
|
|
|
219
183
|
}
|
|
220
184
|
|
|
221
|
-
//
|
|
222
|
-
|
|
223
|
-
renderer.setRenderTarget( this.beautyRenderTarget );
|
|
224
|
-
renderer.clear();
|
|
225
|
-
renderer.render( this.scene, this.camera );
|
|
226
|
-
|
|
227
|
-
// Re-render scene if depth texture extension is not supported
|
|
228
|
-
if ( ! this.supportsDepthTextureExtension ) {
|
|
229
|
-
|
|
230
|
-
// Clear rule : far clipping plane in both RGBA and Basic encoding
|
|
231
|
-
this.renderOverride( renderer, this.depthMaterial, this.depthRenderTarget, 0x000000, 1.0 );
|
|
232
|
-
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
if ( this.supportsNormalTexture ) {
|
|
236
|
-
|
|
237
|
-
// Clear rule : default normal is facing the camera
|
|
238
|
-
this.renderOverride( renderer, this.normalMaterial, this.normalRenderTarget, 0x7777ff, 1.0 );
|
|
239
|
-
|
|
240
|
-
}
|
|
185
|
+
// render normal and depth
|
|
186
|
+
this.renderOverride( renderer, this.normalMaterial, this.normalRenderTarget, 0x7777ff, 1.0 );
|
|
241
187
|
|
|
242
188
|
// Rendering SAO texture
|
|
243
189
|
this.renderPass( renderer, this.saoMaterial, this.saoRenderTarget, 0xffffff, 1.0 );
|
|
@@ -250,24 +196,10 @@ class SAOPass extends Pass {
|
|
|
250
196
|
|
|
251
197
|
}
|
|
252
198
|
|
|
253
|
-
|
|
254
|
-
// Setting up SAO rendering
|
|
255
|
-
if ( this.params.output === 3 ) {
|
|
256
|
-
|
|
257
|
-
if ( this.supportsDepthTextureExtension ) {
|
|
258
|
-
|
|
259
|
-
this.materialCopy.uniforms[ 'tDiffuse' ].value = this.beautyRenderTarget.depthTexture;
|
|
260
|
-
this.materialCopy.needsUpdate = true;
|
|
199
|
+
const outputMaterial = this.materialCopy;
|
|
261
200
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
this.depthCopy.uniforms[ 'tDiffuse' ].value = this.depthRenderTarget.texture;
|
|
265
|
-
this.depthCopy.needsUpdate = true;
|
|
266
|
-
outputMaterial = this.depthCopy;
|
|
267
|
-
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
} else if ( this.params.output === 4 ) {
|
|
201
|
+
// Setting up SAO rendering
|
|
202
|
+
if ( this.params.output === SAOPass.OUTPUT.Normal ) {
|
|
271
203
|
|
|
272
204
|
this.materialCopy.uniforms[ 'tDiffuse' ].value = this.normalRenderTarget.texture;
|
|
273
205
|
this.materialCopy.needsUpdate = true;
|
|
@@ -279,8 +211,8 @@ class SAOPass extends Pass {
|
|
|
279
211
|
|
|
280
212
|
}
|
|
281
213
|
|
|
282
|
-
// Blending depends on output
|
|
283
|
-
if ( this.params.output ===
|
|
214
|
+
// Blending depends on output
|
|
215
|
+
if ( this.params.output === SAOPass.OUTPUT.Default ) {
|
|
284
216
|
|
|
285
217
|
outputMaterial.blending = CustomBlending;
|
|
286
218
|
|
|
@@ -359,11 +291,9 @@ class SAOPass extends Pass {
|
|
|
359
291
|
|
|
360
292
|
setSize( width, height ) {
|
|
361
293
|
|
|
362
|
-
this.beautyRenderTarget.setSize( width, height );
|
|
363
294
|
this.saoRenderTarget.setSize( width, height );
|
|
364
295
|
this.blurIntermediateRenderTarget.setSize( width, height );
|
|
365
296
|
this.normalRenderTarget.setSize( width, height );
|
|
366
|
-
this.depthRenderTarget.setSize( width, height );
|
|
367
297
|
|
|
368
298
|
this.saoMaterial.uniforms[ 'size' ].value.set( width, height );
|
|
369
299
|
this.saoMaterial.uniforms[ 'cameraInverseProjectionMatrix' ].value.copy( this.camera.projectionMatrixInverse );
|
|
@@ -382,9 +312,7 @@ class SAOPass extends Pass {
|
|
|
382
312
|
|
|
383
313
|
this.saoRenderTarget.dispose();
|
|
384
314
|
this.blurIntermediateRenderTarget.dispose();
|
|
385
|
-
this.beautyRenderTarget.dispose();
|
|
386
315
|
this.normalRenderTarget.dispose();
|
|
387
|
-
this.depthRenderTarget.dispose();
|
|
388
316
|
|
|
389
317
|
this.depthMaterial.dispose();
|
|
390
318
|
this.normalMaterial.dispose();
|
|
@@ -392,7 +320,6 @@ class SAOPass extends Pass {
|
|
|
392
320
|
this.vBlurMaterial.dispose();
|
|
393
321
|
this.hBlurMaterial.dispose();
|
|
394
322
|
this.materialCopy.dispose();
|
|
395
|
-
this.depthCopy.dispose();
|
|
396
323
|
|
|
397
324
|
this.fsQuad.dispose();
|
|
398
325
|
|
|
@@ -401,11 +328,9 @@ class SAOPass extends Pass {
|
|
|
401
328
|
}
|
|
402
329
|
|
|
403
330
|
SAOPass.OUTPUT = {
|
|
404
|
-
'Beauty': 1,
|
|
405
331
|
'Default': 0,
|
|
406
|
-
'SAO':
|
|
407
|
-
'
|
|
408
|
-
'Normal': 4
|
|
332
|
+
'SAO': 1,
|
|
333
|
+
'Normal': 2
|
|
409
334
|
};
|
|
410
335
|
|
|
411
336
|
export { SAOPass };
|