super-three 0.172.0 → 0.173.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/LICENSE +1 -1
- package/build/three.cjs +439 -380
- package/build/three.core.js +413 -41
- package/build/three.core.min.js +2 -2
- package/build/three.module.js +28 -344
- package/build/three.module.min.js +2 -2
- package/build/three.tsl.js +11 -3
- package/build/three.tsl.min.js +2 -2
- package/build/three.webgpu.js +7550 -1798
- package/build/three.webgpu.min.js +2 -2
- package/build/three.webgpu.nodes.js +7551 -1798
- package/build/three.webgpu.nodes.min.js +2 -2
- package/examples/jsm/animation/CCDIKSolver.js +6 -5
- package/examples/jsm/capabilities/WebGPU.js +1 -1
- package/examples/jsm/controls/ArcballControls.js +23 -21
- package/examples/jsm/exporters/GLTFExporter.js +26 -25
- package/examples/jsm/geometries/TextGeometry.js +1 -12
- package/examples/jsm/interactive/InteractiveGroup.js +108 -51
- package/examples/jsm/libs/demuxer_mp4.js +109 -0
- package/examples/jsm/loaders/GCodeLoader.js +3 -1
- package/examples/jsm/loaders/GLTFLoader.js +0 -2
- package/examples/jsm/loaders/TDSLoader.js +0 -1
- package/examples/jsm/materials/MeshGouraudMaterial.js +2 -0
- package/examples/jsm/misc/GPUComputationRenderer.js +6 -7
- package/examples/jsm/misc/ProgressiveLightMap.js +4 -3
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +4 -3
- package/examples/jsm/misc/Volume.js +7 -5
- package/examples/jsm/misc/VolumeSlice.js +5 -3
- package/examples/jsm/objects/WaterMesh.js +25 -20
- package/examples/jsm/physics/JoltPhysics.js +7 -7
- package/examples/jsm/physics/RapierPhysics.js +4 -4
- package/examples/jsm/postprocessing/OutputPass.js +2 -0
- package/examples/jsm/shaders/OutputShader.js +5 -1
- package/examples/jsm/transpiler/GLSLDecoder.js +2 -2
- package/examples/jsm/transpiler/TSLEncoder.js +2 -0
- package/package.json +1 -1
- package/src/Three.Core.js +2 -0
- package/src/Three.TSL.js +9 -1
- package/src/cameras/ArrayCamera.js +1 -0
- package/src/constants.js +6 -1
- package/src/core/BufferAttribute.js +4 -0
- package/src/core/EventDispatcher.js +8 -6
- package/src/extras/ImageUtils.js +1 -11
- package/src/loaders/nodes/NodeObjectLoader.js +1 -1
- package/src/materials/nodes/MeshBasicNodeMaterial.js +1 -1
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +1 -1
- package/src/materials/nodes/NodeMaterial.js +5 -5
- package/src/materials/nodes/NodeMaterials.js +0 -1
- package/src/materials/nodes/PointsNodeMaterial.js +109 -7
- package/src/materials/nodes/SpriteNodeMaterial.js +1 -1
- package/src/materials/nodes/VolumeNodeMaterial.js +3 -3
- package/src/materials/nodes/manager/NodeMaterialObserver.js +8 -0
- package/src/nodes/Nodes.js +4 -0
- package/src/nodes/TSL.js +4 -0
- package/src/nodes/accessors/Arrays.js +30 -8
- package/src/nodes/accessors/BatchNode.js +3 -3
- package/src/nodes/accessors/BufferAttributeNode.js +1 -1
- package/src/nodes/accessors/Camera.js +64 -3
- package/src/nodes/accessors/InstanceNode.js +1 -1
- package/src/nodes/accessors/MaterialNode.js +9 -9
- package/src/nodes/accessors/ModelViewProjectionNode.js +1 -1
- package/src/nodes/accessors/Normal.js +6 -2
- package/src/nodes/accessors/Object3DNode.js +0 -1
- package/src/nodes/accessors/Position.js +6 -6
- package/src/nodes/accessors/ReferenceBaseNode.js +2 -4
- package/src/nodes/accessors/ReferenceNode.js +2 -3
- package/src/nodes/accessors/StorageBufferNode.js +42 -5
- package/src/nodes/accessors/Tangent.js +2 -2
- package/src/nodes/accessors/Texture3DNode.js +1 -1
- package/src/nodes/accessors/TextureNode.js +12 -5
- package/src/nodes/accessors/UniformArrayNode.js +9 -3
- package/src/nodes/accessors/VelocityNode.js +0 -2
- package/src/nodes/code/ScriptableNode.js +3 -3
- package/src/nodes/core/ArrayNode.js +125 -0
- package/src/nodes/core/ConstNode.js +8 -0
- package/src/nodes/core/Node.js +14 -1
- package/src/nodes/core/NodeBuilder.js +229 -19
- package/src/nodes/core/NodeUtils.js +11 -1
- package/src/nodes/core/NodeVar.js +17 -1
- package/src/nodes/core/OutputStructNode.js +19 -9
- package/src/nodes/core/StackNode.js +20 -1
- package/src/nodes/core/StructNode.js +121 -0
- package/src/nodes/core/StructType.js +13 -0
- package/src/nodes/core/StructTypeNode.js +82 -21
- package/src/nodes/core/TempNode.js +1 -1
- package/src/nodes/core/VarNode.js +94 -7
- package/src/nodes/core/VaryingNode.js +19 -3
- package/src/nodes/display/BlendModes.js +88 -1
- package/src/nodes/display/BumpMapNode.js +6 -6
- package/src/nodes/display/NormalMapNode.js +6 -6
- package/src/nodes/display/PassNode.js +3 -1
- package/src/nodes/display/ScreenNode.js +9 -0
- package/src/nodes/fog/Fog.js +17 -0
- package/src/nodes/gpgpu/AtomicFunctionNode.js +20 -4
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +8 -0
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +1 -1
- package/src/nodes/lighting/ShadowNode.js +1 -1
- package/src/nodes/math/ConditionalNode.js +8 -1
- package/src/nodes/math/MathNode.js +14 -1
- package/src/nodes/math/OperatorNode.js +96 -18
- package/src/nodes/pmrem/PMREMUtils.js +1 -1
- package/src/nodes/shapes/Shapes.js +33 -0
- package/src/nodes/tsl/TSLBase.js +1 -0
- package/src/nodes/tsl/TSLCore.js +22 -2
- package/src/nodes/utils/ArrayElementNode.js +1 -1
- package/src/nodes/utils/LoopNode.js +8 -1
- package/src/nodes/utils/MemberNode.js +68 -0
- package/src/nodes/utils/StorageArrayElementNode.js +14 -0
- package/src/nodes/utils/Timer.js +21 -0
- package/src/objects/BatchedMesh.js +1 -1
- package/src/objects/Line.js +6 -6
- package/src/renderers/WebGLRenderer.js +7 -0
- package/src/renderers/common/Animation.js +23 -1
- package/src/renderers/common/Backend.js +58 -15
- package/src/renderers/common/Background.js +14 -0
- package/src/renderers/common/Binding.js +1 -1
- package/src/renderers/common/BufferUtils.js +1 -1
- package/src/renderers/common/BundleGroup.js +1 -1
- package/src/renderers/common/ChainMap.js +9 -7
- package/src/renderers/common/ClippingContext.js +1 -1
- package/src/renderers/common/Color4.js +7 -3
- package/src/renderers/common/Geometries.js +2 -23
- package/src/renderers/common/Info.js +1 -45
- package/src/renderers/common/Lighting.js +8 -6
- package/src/renderers/common/Pipelines.js +3 -3
- package/src/renderers/common/PostProcessing.js +24 -8
- package/src/renderers/common/QuadMesh.js +1 -1
- package/src/renderers/common/RenderBundles.js +9 -3
- package/src/renderers/common/RenderContext.js +37 -3
- package/src/renderers/common/RenderContexts.js +30 -17
- package/src/renderers/common/RenderList.js +2 -2
- package/src/renderers/common/RenderLists.js +9 -3
- package/src/renderers/common/RenderObject.js +76 -17
- package/src/renderers/common/RenderObjects.js +9 -7
- package/src/renderers/common/Renderer.js +86 -67
- package/src/renderers/common/SampledTexture.js +0 -1
- package/src/renderers/common/StorageBufferAttribute.js +1 -1
- package/src/renderers/common/StorageInstancedBufferAttribute.js +1 -1
- package/src/renderers/common/StorageTexture.js +1 -1
- package/src/renderers/common/Textures.js +14 -7
- package/src/renderers/common/TimestampQueryPool.js +39 -0
- package/src/renderers/common/Uniform.js +37 -1
- package/src/renderers/common/UniformsGroup.js +2 -0
- package/src/renderers/common/XRManager.js +1193 -0
- package/src/renderers/common/XRRenderTarget.js +74 -0
- package/src/renderers/common/extras/PMREMGenerator.js +53 -8
- package/src/renderers/common/nodes/NodeBuilderState.js +4 -4
- package/src/renderers/common/nodes/NodeLibrary.js +5 -5
- package/src/renderers/common/nodes/NodeSampledTexture.js +0 -1
- package/src/renderers/common/nodes/NodeUniform.js +54 -2
- package/src/renderers/common/nodes/Nodes.js +25 -18
- package/src/renderers/webgl/WebGLBackground.js +4 -0
- package/src/renderers/webgl-fallback/WebGLBackend.js +295 -110
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +347 -17
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +57 -0
- package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +28 -0
- package/src/renderers/webgl-fallback/utils/WebGLExtensions.js +45 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +323 -11
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +167 -21
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +359 -0
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +43 -0
- package/src/renderers/webgpu/WebGPUBackend.js +132 -149
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +6 -4
- package/src/renderers/webgpu/WebGPURenderer.js +5 -4
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +615 -41
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +85 -6
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +85 -0
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +102 -3
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +98 -1
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +257 -9
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +274 -0
- package/src/renderers/webgpu/utils/WebGPUUtils.js +86 -4
- package/src/renderers/webxr/WebXRManager.js +13 -2
- package/src/textures/VideoFrameTexture.js +35 -0
- package/examples/jsm/geometries/InstancedPointsGeometry.js +0 -176
- package/examples/jsm/objects/InstancedPoints.js +0 -19
- package/src/materials/nodes/InstancedPointsNodeMaterial.js +0 -209
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +0 -37
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import NodeMaterial from './NodeMaterial.js';
|
|
2
|
-
import { attribute } from '../../nodes/core/AttributeNode.js';
|
|
3
|
-
import { cameraProjectionMatrix } from '../../nodes/accessors/Camera.js';
|
|
4
|
-
import { materialColor, materialOpacity, materialPointWidth } from '../../nodes/accessors/MaterialNode.js'; // or should this be a property, instead?
|
|
5
|
-
import { modelViewMatrix } from '../../nodes/accessors/ModelNode.js';
|
|
6
|
-
import { positionGeometry } from '../../nodes/accessors/Position.js';
|
|
7
|
-
import { smoothstep, lengthSq } from '../../nodes/math/MathNode.js';
|
|
8
|
-
import { Fn, vec4, float } from '../../nodes/tsl/TSLBase.js';
|
|
9
|
-
import { uv } from '../../nodes/accessors/UV.js';
|
|
10
|
-
import { viewport } from '../../nodes/display/ScreenNode.js';
|
|
11
|
-
|
|
12
|
-
import { PointsMaterial } from '../PointsMaterial.js';
|
|
13
|
-
|
|
14
|
-
const _defaultValues = /*@__PURE__*/ new PointsMaterial();
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Unlike WebGL, WebGPU can render point primitives only with a size
|
|
18
|
-
* of one pixel. This type node material can be used to mimic the WebGL
|
|
19
|
-
* points rendering by rendering small planes via instancing.
|
|
20
|
-
*
|
|
21
|
-
* This material should be used with {@link InstancedPointsGeometry}.
|
|
22
|
-
*
|
|
23
|
-
* @augments NodeMaterial
|
|
24
|
-
*/
|
|
25
|
-
class InstancedPointsNodeMaterial extends NodeMaterial {
|
|
26
|
-
|
|
27
|
-
static get type() {
|
|
28
|
-
|
|
29
|
-
return 'InstancedPointsNodeMaterial';
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Constructs a new instanced points node material.
|
|
35
|
-
*
|
|
36
|
-
* @param {Object?} parameters - The configuration parameter.
|
|
37
|
-
*/
|
|
38
|
-
constructor( parameters = {} ) {
|
|
39
|
-
|
|
40
|
-
super();
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* This flag can be used for type testing.
|
|
44
|
-
*
|
|
45
|
-
* @type {Boolean}
|
|
46
|
-
* @readonly
|
|
47
|
-
* @default true
|
|
48
|
-
*/
|
|
49
|
-
this.isInstancedPointsNodeMaterial = true;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Whether vertex colors should be used or not. If set to `true`,
|
|
53
|
-
* each point instance can receive a custom color value.
|
|
54
|
-
*
|
|
55
|
-
* @type {Boolean}
|
|
56
|
-
* @default false
|
|
57
|
-
*/
|
|
58
|
-
this.useColor = parameters.vertexColors;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* The points width in pixels.
|
|
62
|
-
*
|
|
63
|
-
* @type {Number}
|
|
64
|
-
* @default 1
|
|
65
|
-
*/
|
|
66
|
-
this.pointWidth = 1;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* This node can be used to define the colors for each instance.
|
|
70
|
-
*
|
|
71
|
-
* @type {Node<vec3>?}
|
|
72
|
-
* @default null
|
|
73
|
-
*/
|
|
74
|
-
this.pointColorNode = null;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* This node can be used to define the width for each point instance.
|
|
78
|
-
*
|
|
79
|
-
* @type {Node<float>?}
|
|
80
|
-
* @default null
|
|
81
|
-
*/
|
|
82
|
-
this.pointWidthNode = null;
|
|
83
|
-
|
|
84
|
-
this._useAlphaToCoverage = true;
|
|
85
|
-
|
|
86
|
-
this.setDefaultValues( _defaultValues );
|
|
87
|
-
|
|
88
|
-
this.setValues( parameters );
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Setups the vertex and fragment stage of this node material.
|
|
94
|
-
*
|
|
95
|
-
* @param {NodeBuilder} builder - The current node builder.
|
|
96
|
-
*/
|
|
97
|
-
setup( builder ) {
|
|
98
|
-
|
|
99
|
-
const { renderer } = builder;
|
|
100
|
-
|
|
101
|
-
const useAlphaToCoverage = this._useAlphaToCoverage;
|
|
102
|
-
const useColor = this.useColor;
|
|
103
|
-
|
|
104
|
-
this.vertexNode = Fn( () => {
|
|
105
|
-
|
|
106
|
-
const instancePosition = attribute( 'instancePosition' ).xyz;
|
|
107
|
-
|
|
108
|
-
// camera space
|
|
109
|
-
const mvPos = vec4( modelViewMatrix.mul( vec4( instancePosition, 1.0 ) ) );
|
|
110
|
-
|
|
111
|
-
const aspect = viewport.z.div( viewport.w );
|
|
112
|
-
|
|
113
|
-
// clip space
|
|
114
|
-
const clipPos = cameraProjectionMatrix.mul( mvPos );
|
|
115
|
-
|
|
116
|
-
// offset in ndc space
|
|
117
|
-
const offset = positionGeometry.xy.toVar();
|
|
118
|
-
|
|
119
|
-
offset.mulAssign( this.pointWidthNode ? this.pointWidthNode : materialPointWidth );
|
|
120
|
-
|
|
121
|
-
offset.assign( offset.div( viewport.z ) );
|
|
122
|
-
offset.y.assign( offset.y.mul( aspect ) );
|
|
123
|
-
|
|
124
|
-
// back to clip space
|
|
125
|
-
offset.assign( offset.mul( clipPos.w ) );
|
|
126
|
-
|
|
127
|
-
//clipPos.xy += offset;
|
|
128
|
-
clipPos.addAssign( vec4( offset, 0, 0 ) );
|
|
129
|
-
|
|
130
|
-
return clipPos;
|
|
131
|
-
|
|
132
|
-
} )();
|
|
133
|
-
|
|
134
|
-
this.fragmentNode = Fn( () => {
|
|
135
|
-
|
|
136
|
-
const alpha = float( 1 ).toVar();
|
|
137
|
-
|
|
138
|
-
const len2 = lengthSq( uv().mul( 2 ).sub( 1 ) );
|
|
139
|
-
|
|
140
|
-
if ( useAlphaToCoverage && renderer.samples > 1 ) {
|
|
141
|
-
|
|
142
|
-
const dlen = float( len2.fwidth() ).toVar();
|
|
143
|
-
|
|
144
|
-
alpha.assign( smoothstep( dlen.oneMinus(), dlen.add( 1 ), len2 ).oneMinus() );
|
|
145
|
-
|
|
146
|
-
} else {
|
|
147
|
-
|
|
148
|
-
len2.greaterThan( 1.0 ).discard();
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
let pointColorNode;
|
|
153
|
-
|
|
154
|
-
if ( this.pointColorNode ) {
|
|
155
|
-
|
|
156
|
-
pointColorNode = this.pointColorNode;
|
|
157
|
-
|
|
158
|
-
} else {
|
|
159
|
-
|
|
160
|
-
if ( useColor ) {
|
|
161
|
-
|
|
162
|
-
const instanceColor = attribute( 'instanceColor' );
|
|
163
|
-
|
|
164
|
-
pointColorNode = instanceColor.mul( materialColor );
|
|
165
|
-
|
|
166
|
-
} else {
|
|
167
|
-
|
|
168
|
-
pointColorNode = materialColor;
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
alpha.mulAssign( materialOpacity );
|
|
175
|
-
|
|
176
|
-
return vec4( pointColorNode, alpha );
|
|
177
|
-
|
|
178
|
-
} )();
|
|
179
|
-
|
|
180
|
-
super.setup( builder );
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Whether alpha to coverage should be used or not.
|
|
186
|
-
*
|
|
187
|
-
* @type {Boolean}
|
|
188
|
-
* @default true
|
|
189
|
-
*/
|
|
190
|
-
get alphaToCoverage() {
|
|
191
|
-
|
|
192
|
-
return this._useAlphaToCoverage;
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
set alphaToCoverage( value ) {
|
|
197
|
-
|
|
198
|
-
if ( this._useAlphaToCoverage !== value ) {
|
|
199
|
-
|
|
200
|
-
this._useAlphaToCoverage = value;
|
|
201
|
-
this.needsUpdate = true;
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
export default InstancedPointsNodeMaterial;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import MaterialNode from './MaterialNode.js';
|
|
2
|
-
import { nodeImmutable } from '../tsl/TSLBase.js';
|
|
3
|
-
|
|
4
|
-
/** @module InstancedPointsMaterialNode **/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* An extension of material node to provide pre-defined
|
|
8
|
-
* TSL objects in context of `InstancedPointsNodeMaterial`.
|
|
9
|
-
*
|
|
10
|
-
* @augments module:MaterialNode~MaterialNode
|
|
11
|
-
*/
|
|
12
|
-
class InstancedPointsMaterialNode extends MaterialNode {
|
|
13
|
-
|
|
14
|
-
static get type() {
|
|
15
|
-
|
|
16
|
-
return 'InstancedPointsMaterialNode';
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
setup( /*builder*/ ) {
|
|
21
|
-
|
|
22
|
-
return this.getFloat( this.scope );
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
InstancedPointsMaterialNode.POINT_WIDTH = 'pointWidth';
|
|
29
|
-
|
|
30
|
-
export default InstancedPointsMaterialNode;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* TSL object that represents the point width of the current points material.
|
|
34
|
-
*
|
|
35
|
-
* @type {InstancedPointsMaterialNode<float>}
|
|
36
|
-
*/
|
|
37
|
-
export const materialPointWidth = /*@__PURE__*/ nodeImmutable( InstancedPointsMaterialNode, InstancedPointsMaterialNode.POINT_WIDTH );
|