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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import NodeMaterial
|
|
1
|
+
import NodeMaterial from './NodeMaterial.js';
|
|
2
2
|
import { shininess, specularColor } from '../../nodes/core/PropertyNode.js';
|
|
3
3
|
import { materialShininess, materialSpecular } from '../../nodes/accessors/MaterialNode.js';
|
|
4
4
|
import { float } from '../../nodes/tsl/TSLBase.js';
|
|
@@ -11,6 +11,12 @@ const _defaultValues = /*@__PURE__*/ new MeshPhongMaterial();
|
|
|
11
11
|
|
|
12
12
|
class MeshPhongNodeMaterial extends NodeMaterial {
|
|
13
13
|
|
|
14
|
+
static get type() {
|
|
15
|
+
|
|
16
|
+
return 'MeshPhongNodeMaterial';
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
14
20
|
constructor( parameters ) {
|
|
15
21
|
|
|
16
22
|
super();
|
|
@@ -70,5 +76,3 @@ class MeshPhongNodeMaterial extends NodeMaterial {
|
|
|
70
76
|
}
|
|
71
77
|
|
|
72
78
|
export default MeshPhongNodeMaterial;
|
|
73
|
-
|
|
74
|
-
MeshPhongNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshPhong', MeshPhongNodeMaterial );
|
|
@@ -8,12 +8,17 @@ import MeshStandardNodeMaterial from './MeshStandardNodeMaterial.js';
|
|
|
8
8
|
import { mix, pow2, min } from '../../nodes/math/MathNode.js';
|
|
9
9
|
|
|
10
10
|
import { MeshPhysicalMaterial } from '../MeshPhysicalMaterial.js';
|
|
11
|
-
import { registerNodeMaterial } from './NodeMaterial.js';
|
|
12
11
|
|
|
13
12
|
const _defaultValues = /*@__PURE__*/ new MeshPhysicalMaterial();
|
|
14
13
|
|
|
15
14
|
class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
|
|
16
15
|
|
|
16
|
+
static get type() {
|
|
17
|
+
|
|
18
|
+
return 'MeshPhysicalNodeMaterial';
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
17
22
|
constructor( parameters ) {
|
|
18
23
|
|
|
19
24
|
super();
|
|
@@ -241,5 +246,3 @@ class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
|
|
|
241
246
|
}
|
|
242
247
|
|
|
243
248
|
export default MeshPhysicalNodeMaterial;
|
|
244
|
-
|
|
245
|
-
MeshPhysicalNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshPhysical', MeshPhysicalNodeMaterial );
|
|
@@ -3,7 +3,6 @@ import PhysicalLightingModel from '../../nodes/functions/PhysicalLightingModel.j
|
|
|
3
3
|
import { transformedNormalView } from '../../nodes/accessors/Normal.js';
|
|
4
4
|
import { positionViewDirection } from '../../nodes/accessors/Position.js';
|
|
5
5
|
import { float, vec3 } from '../../nodes/tsl/TSLBase.js';
|
|
6
|
-
import { registerNodeMaterial } from './NodeMaterial.js';
|
|
7
6
|
|
|
8
7
|
class SSSLightingModel extends PhysicalLightingModel {
|
|
9
8
|
|
|
@@ -39,6 +38,12 @@ class SSSLightingModel extends PhysicalLightingModel {
|
|
|
39
38
|
|
|
40
39
|
class MeshSSSNodeMaterial extends MeshPhysicalNodeMaterial {
|
|
41
40
|
|
|
41
|
+
static get type() {
|
|
42
|
+
|
|
43
|
+
return 'MeshSSSNodeMaterial';
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
|
|
42
47
|
constructor( parameters ) {
|
|
43
48
|
|
|
44
49
|
super( parameters );
|
|
@@ -80,5 +85,3 @@ class MeshSSSNodeMaterial extends MeshPhysicalNodeMaterial {
|
|
|
80
85
|
}
|
|
81
86
|
|
|
82
87
|
export default MeshSSSNodeMaterial;
|
|
83
|
-
|
|
84
|
-
MeshSSSNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshSSS', MeshSSSNodeMaterial );
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import NodeMaterial
|
|
1
|
+
import NodeMaterial from './NodeMaterial.js';
|
|
2
2
|
import { diffuseColor, metalness, roughness, specularColor, specularF90 } from '../../nodes/core/PropertyNode.js';
|
|
3
3
|
import { mix } from '../../nodes/math/MathNode.js';
|
|
4
4
|
import { materialRoughness, materialMetalness } from '../../nodes/accessors/MaterialNode.js';
|
|
@@ -13,6 +13,12 @@ const _defaultValues = /*@__PURE__*/ new MeshStandardMaterial();
|
|
|
13
13
|
|
|
14
14
|
class MeshStandardNodeMaterial extends NodeMaterial {
|
|
15
15
|
|
|
16
|
+
static get type() {
|
|
17
|
+
|
|
18
|
+
return 'MeshStandardNodeMaterial';
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
16
22
|
constructor( parameters ) {
|
|
17
23
|
|
|
18
24
|
super();
|
|
@@ -100,5 +106,3 @@ class MeshStandardNodeMaterial extends NodeMaterial {
|
|
|
100
106
|
}
|
|
101
107
|
|
|
102
108
|
export default MeshStandardNodeMaterial;
|
|
103
|
-
|
|
104
|
-
MeshStandardNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshStandard', MeshStandardNodeMaterial );
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import NodeMaterial
|
|
1
|
+
import NodeMaterial from './NodeMaterial.js';
|
|
2
2
|
import ToonLightingModel from '../../nodes/functions/ToonLightingModel.js';
|
|
3
3
|
|
|
4
4
|
import { MeshToonMaterial } from '../MeshToonMaterial.js';
|
|
@@ -7,6 +7,12 @@ const _defaultValues = /*@__PURE__*/ new MeshToonMaterial();
|
|
|
7
7
|
|
|
8
8
|
class MeshToonNodeMaterial extends NodeMaterial {
|
|
9
9
|
|
|
10
|
+
static get type() {
|
|
11
|
+
|
|
12
|
+
return 'MeshToonNodeMaterial';
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
|
|
10
16
|
constructor( parameters ) {
|
|
11
17
|
|
|
12
18
|
super();
|
|
@@ -30,5 +36,3 @@ class MeshToonNodeMaterial extends NodeMaterial {
|
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
export default MeshToonNodeMaterial;
|
|
33
|
-
|
|
34
|
-
MeshToonNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshToon', MeshToonNodeMaterial );
|
|
@@ -22,11 +22,16 @@ import IrradianceNode from '../../nodes/lighting/IrradianceNode.js';
|
|
|
22
22
|
import { depth } from '../../nodes/display/ViewportDepthNode.js';
|
|
23
23
|
import { cameraLogDepth } from '../../nodes/accessors/Camera.js';
|
|
24
24
|
import { clipping, clippingAlpha } from '../../nodes/accessors/ClippingNode.js';
|
|
25
|
-
|
|
26
|
-
const NodeMaterials = new Map();
|
|
25
|
+
import NodeMaterialObserver from './manager/NodeMaterialObserver.js';
|
|
27
26
|
|
|
28
27
|
class NodeMaterial extends Material {
|
|
29
28
|
|
|
29
|
+
static get type() {
|
|
30
|
+
|
|
31
|
+
return 'NodeMaterial';
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
30
35
|
constructor() {
|
|
31
36
|
|
|
32
37
|
super();
|
|
@@ -77,6 +82,12 @@ class NodeMaterial extends Material {
|
|
|
77
82
|
|
|
78
83
|
}
|
|
79
84
|
|
|
85
|
+
setupObserver( builder ) {
|
|
86
|
+
|
|
87
|
+
return new NodeMaterialObserver( builder );
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
|
|
80
91
|
setup( builder ) {
|
|
81
92
|
|
|
82
93
|
builder.context.setupNormal = () => this.setupNormal( builder );
|
|
@@ -167,6 +178,10 @@ class NodeMaterial extends Material {
|
|
|
167
178
|
|
|
168
179
|
builder.addFlow( 'fragment', builder.removeStack() );
|
|
169
180
|
|
|
181
|
+
// < MONITOR >
|
|
182
|
+
|
|
183
|
+
builder.monitor = this.setupObserver( builder );
|
|
184
|
+
|
|
170
185
|
}
|
|
171
186
|
|
|
172
187
|
setupClipping( builder ) {
|
|
@@ -179,7 +194,9 @@ class NodeMaterial extends Material {
|
|
|
179
194
|
|
|
180
195
|
if ( globalClippingCount || localClippingCount ) {
|
|
181
196
|
|
|
182
|
-
|
|
197
|
+
const samples = builder.renderer.samples;
|
|
198
|
+
|
|
199
|
+
if ( this.alphaToCoverage && samples > 1 ) {
|
|
183
200
|
|
|
184
201
|
// to be added to flow when the color/alpha value has been determined
|
|
185
202
|
result = clippingAlpha();
|
|
@@ -623,45 +640,3 @@ class NodeMaterial extends Material {
|
|
|
623
640
|
}
|
|
624
641
|
|
|
625
642
|
export default NodeMaterial;
|
|
626
|
-
|
|
627
|
-
NodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( '', NodeMaterial );
|
|
628
|
-
|
|
629
|
-
export function registerNodeMaterial( type, nodeMaterialClass ) {
|
|
630
|
-
|
|
631
|
-
const suffix = 'NodeMaterial';
|
|
632
|
-
const nodeMaterialType = type + suffix;
|
|
633
|
-
|
|
634
|
-
if ( typeof nodeMaterialClass !== 'function' ) throw new Error( `THREE.Node: NodeMaterial class "${ type }" is not a class.` );
|
|
635
|
-
|
|
636
|
-
if ( NodeMaterials.has( nodeMaterialType ) ) {
|
|
637
|
-
|
|
638
|
-
console.warn( `THREE.Node: Redefinition of NodeMaterial class "${ nodeMaterialType }".` );
|
|
639
|
-
return;
|
|
640
|
-
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
if ( type.slice( - suffix.length ) === suffix ) {
|
|
644
|
-
|
|
645
|
-
console.warn( `THREE.NodeMaterial: NodeMaterial class ${ nodeMaterialType } should not have '${ suffix }' suffix.` );
|
|
646
|
-
return;
|
|
647
|
-
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
NodeMaterials.set( nodeMaterialType, nodeMaterialClass );
|
|
651
|
-
nodeMaterialClass.type = nodeMaterialType;
|
|
652
|
-
|
|
653
|
-
return nodeMaterialType;
|
|
654
|
-
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
export function createNodeMaterialFromType( type ) {
|
|
658
|
-
|
|
659
|
-
const Material = NodeMaterials.get( type );
|
|
660
|
-
|
|
661
|
-
if ( Material !== undefined ) {
|
|
662
|
-
|
|
663
|
-
return new Material();
|
|
664
|
-
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// @TODO: We can simplify "export { default as SomeNode, other, exports } from '...'" to just "export * from '...'" if we will use only named exports
|
|
2
2
|
|
|
3
|
+
export { default as NodeMaterialObserver } from './manager/NodeMaterialObserver.js';
|
|
4
|
+
|
|
3
5
|
export { default as NodeMaterial } from './NodeMaterial.js';
|
|
4
6
|
export { default as InstancedPointsNodeMaterial } from './InstancedPointsNodeMaterial.js';
|
|
5
7
|
export { default as LineBasicNodeMaterial } from './LineBasicNodeMaterial.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import NodeMaterial
|
|
1
|
+
import NodeMaterial from './NodeMaterial.js';
|
|
2
2
|
|
|
3
3
|
import { PointsMaterial } from '../PointsMaterial.js';
|
|
4
4
|
|
|
@@ -6,6 +6,12 @@ const _defaultValues = /*@__PURE__*/ new PointsMaterial();
|
|
|
6
6
|
|
|
7
7
|
class PointsNodeMaterial extends NodeMaterial {
|
|
8
8
|
|
|
9
|
+
static get type() {
|
|
10
|
+
|
|
11
|
+
return 'PointsNodeMaterial';
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
|
|
9
15
|
constructor( parameters ) {
|
|
10
16
|
|
|
11
17
|
super();
|
|
@@ -34,5 +40,3 @@ class PointsNodeMaterial extends NodeMaterial {
|
|
|
34
40
|
}
|
|
35
41
|
|
|
36
42
|
export default PointsNodeMaterial;
|
|
37
|
-
|
|
38
|
-
PointsNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'Points', PointsNodeMaterial );
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import NodeMaterial
|
|
1
|
+
import NodeMaterial from './NodeMaterial.js';
|
|
2
2
|
import ShadowMaskModel from '../../nodes/functions/ShadowMaskModel.js';
|
|
3
3
|
|
|
4
4
|
import { ShadowMaterial } from '../ShadowMaterial.js';
|
|
@@ -7,6 +7,12 @@ const _defaultValues = /*@__PURE__*/ new ShadowMaterial();
|
|
|
7
7
|
|
|
8
8
|
class ShadowNodeMaterial extends NodeMaterial {
|
|
9
9
|
|
|
10
|
+
static get type() {
|
|
11
|
+
|
|
12
|
+
return 'ShadowNodeMaterial';
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
|
|
10
16
|
constructor( parameters ) {
|
|
11
17
|
|
|
12
18
|
super();
|
|
@@ -30,5 +36,3 @@ class ShadowNodeMaterial extends NodeMaterial {
|
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
export default ShadowNodeMaterial;
|
|
33
|
-
|
|
34
|
-
ShadowNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'Shadow', ShadowNodeMaterial );
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import NodeMaterial
|
|
2
|
-
import { uniform } from '../../nodes/core/UniformNode.js';
|
|
1
|
+
import NodeMaterial from './NodeMaterial.js';
|
|
3
2
|
import { cameraProjectionMatrix } from '../../nodes/accessors/Camera.js';
|
|
4
3
|
import { materialRotation } from '../../nodes/accessors/MaterialNode.js';
|
|
5
4
|
import { modelViewMatrix, modelWorldMatrix } from '../../nodes/accessors/ModelNode.js';
|
|
@@ -8,11 +7,18 @@ import { rotate } from '../../nodes/utils/RotateNode.js';
|
|
|
8
7
|
import { float, vec2, vec3, vec4 } from '../../nodes/tsl/TSLBase.js';
|
|
9
8
|
|
|
10
9
|
import { SpriteMaterial } from '../SpriteMaterial.js';
|
|
10
|
+
import { reference } from '../../nodes/accessors/ReferenceBaseNode.js';
|
|
11
11
|
|
|
12
12
|
const _defaultValues = /*@__PURE__*/ new SpriteMaterial();
|
|
13
13
|
|
|
14
14
|
class SpriteNodeMaterial extends NodeMaterial {
|
|
15
15
|
|
|
16
|
+
static get type() {
|
|
17
|
+
|
|
18
|
+
return 'SpriteNodeMaterial';
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
16
22
|
constructor( parameters ) {
|
|
17
23
|
|
|
18
24
|
super();
|
|
@@ -20,6 +26,7 @@ class SpriteNodeMaterial extends NodeMaterial {
|
|
|
20
26
|
this.isSpriteNodeMaterial = true;
|
|
21
27
|
|
|
22
28
|
this.lights = false;
|
|
29
|
+
this._useSizeAttenuation = true;
|
|
23
30
|
|
|
24
31
|
this.positionNode = null;
|
|
25
32
|
this.rotationNode = null;
|
|
@@ -31,7 +38,9 @@ class SpriteNodeMaterial extends NodeMaterial {
|
|
|
31
38
|
|
|
32
39
|
}
|
|
33
40
|
|
|
34
|
-
setupPosition( { object, context } ) {
|
|
41
|
+
setupPosition( { object, camera, context } ) {
|
|
42
|
+
|
|
43
|
+
const sizeAttenuation = this.sizeAttenuation;
|
|
35
44
|
|
|
36
45
|
// < VERTEX STAGE >
|
|
37
46
|
|
|
@@ -49,11 +58,20 @@ class SpriteNodeMaterial extends NodeMaterial {
|
|
|
49
58
|
|
|
50
59
|
}
|
|
51
60
|
|
|
61
|
+
|
|
62
|
+
if ( ! sizeAttenuation && camera.isPerspectiveCamera ) {
|
|
63
|
+
|
|
64
|
+
scale = scale.mul( mvPosition.z.negate() );
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
|
|
52
68
|
let alignedPosition = vertex.xy;
|
|
53
69
|
|
|
54
70
|
if ( object.center && object.center.isVector2 === true ) {
|
|
55
71
|
|
|
56
|
-
|
|
72
|
+
const center = reference( 'center', 'vec2' );
|
|
73
|
+
|
|
74
|
+
alignedPosition = alignedPosition.sub( center.sub( 0.5 ) );
|
|
57
75
|
|
|
58
76
|
}
|
|
59
77
|
|
|
@@ -83,8 +101,23 @@ class SpriteNodeMaterial extends NodeMaterial {
|
|
|
83
101
|
|
|
84
102
|
}
|
|
85
103
|
|
|
104
|
+
get sizeAttenuation() {
|
|
105
|
+
|
|
106
|
+
return this._useSizeAttenuation;
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
set sizeAttenuation( value ) {
|
|
111
|
+
|
|
112
|
+
if ( this._useSizeAttenuation !== value ) {
|
|
113
|
+
|
|
114
|
+
this._useSizeAttenuation = value;
|
|
115
|
+
this.needsUpdate = true;
|
|
116
|
+
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
}
|
|
120
|
+
|
|
86
121
|
}
|
|
87
122
|
|
|
88
123
|
export default SpriteNodeMaterial;
|
|
89
|
-
|
|
90
|
-
SpriteNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'Sprite', SpriteNodeMaterial );
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import NodeMaterial
|
|
1
|
+
import NodeMaterial from './NodeMaterial.js';
|
|
2
2
|
import { property } from '../../nodes/core/PropertyNode.js';
|
|
3
3
|
import { materialReference } from '../../nodes/accessors/MaterialReferenceNode.js';
|
|
4
4
|
import { modelWorldMatrixInverse } from '../../nodes/accessors/ModelNode.js';
|
|
5
5
|
import { cameraPosition } from '../../nodes/accessors/Camera.js';
|
|
6
6
|
import { positionGeometry } from '../../nodes/accessors/Position.js';
|
|
7
|
-
import { Fn, varying, vec2, vec3, vec4 } from '../../nodes/tsl/TSLBase.js';
|
|
7
|
+
import { Fn, varying, float, vec2, vec3, vec4 } from '../../nodes/tsl/TSLBase.js';
|
|
8
8
|
import { min, max } from '../../nodes/math/MathNode.js';
|
|
9
9
|
import { Loop, Break } from '../../nodes/utils/LoopNode.js';
|
|
10
10
|
import { texture3D } from '../../nodes/accessors/Texture3DNode.js';
|
|
11
11
|
|
|
12
12
|
class VolumeNodeMaterial extends NodeMaterial {
|
|
13
13
|
|
|
14
|
+
static get type() {
|
|
15
|
+
|
|
16
|
+
return 'VolumeNodeMaterial';
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
14
20
|
constructor( params = {} ) {
|
|
15
21
|
|
|
16
22
|
super();
|
|
@@ -53,19 +59,19 @@ class VolumeNodeMaterial extends NodeMaterial {
|
|
|
53
59
|
const vDirection = varying( positionGeometry.sub( vOrigin ) );
|
|
54
60
|
|
|
55
61
|
const rayDir = vDirection.normalize();
|
|
56
|
-
const bounds =
|
|
62
|
+
const bounds = vec2( hitBox( { orig: vOrigin, dir: rayDir } ) ).toVar();
|
|
57
63
|
|
|
58
64
|
bounds.x.greaterThan( bounds.y ).discard();
|
|
59
65
|
|
|
60
66
|
bounds.assign( vec2( max( bounds.x, 0.0 ), bounds.y ) );
|
|
61
67
|
|
|
62
|
-
const p =
|
|
63
|
-
const inc =
|
|
64
|
-
const delta =
|
|
68
|
+
const p = vec3( vOrigin.add( bounds.x.mul( rayDir ) ) ).toVar();
|
|
69
|
+
const inc = vec3( rayDir.abs().reciprocal() ).toVar();
|
|
70
|
+
const delta = float( min( inc.x, min( inc.y, inc.z ) ) ).toVar( 'delta' ); // used 'delta' name in loop
|
|
65
71
|
|
|
66
72
|
delta.divAssign( materialReference( 'steps', 'float' ) );
|
|
67
73
|
|
|
68
|
-
const ac =
|
|
74
|
+
const ac = vec4( materialReference( 'base', 'color' ), 0.0 ).toVar();
|
|
69
75
|
|
|
70
76
|
Loop( { type: 'float', start: bounds.x, end: bounds.y, update: '+= delta' }, () => {
|
|
71
77
|
|
|
@@ -100,5 +106,3 @@ class VolumeNodeMaterial extends NodeMaterial {
|
|
|
100
106
|
}
|
|
101
107
|
|
|
102
108
|
export default VolumeNodeMaterial;
|
|
103
|
-
|
|
104
|
-
VolumeNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'Volume', VolumeNodeMaterial );
|