super-three 0.163.0 → 0.164.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 +473 -245
- package/build/three.module.js +473 -245
- package/build/three.module.min.js +2 -2
- package/examples/jsm/animation/CCDIKSolver.js +4 -2
- package/examples/jsm/exporters/GLTFExporter.js +45 -1
- package/examples/jsm/exporters/USDZExporter.js +7 -1
- package/examples/jsm/libs/draco/README.md +2 -2
- package/examples/jsm/loaders/EXRLoader.js +283 -99
- package/examples/jsm/loaders/GLTFLoader.js +53 -0
- package/examples/jsm/loaders/KTX2Loader.js +3 -6
- package/examples/jsm/loaders/VRMLLoader.js +1 -1
- package/examples/jsm/loaders/lwo/IFFParser.js +8 -5
- package/examples/jsm/materials/MeshGouraudMaterial.js +7 -1
- package/examples/jsm/math/Octree.js +26 -20
- package/examples/jsm/nodes/Nodes.js +4 -3
- package/examples/jsm/nodes/accessors/AccessorsUtils.js +16 -1
- package/examples/jsm/nodes/accessors/ClippingNode.js +3 -2
- package/examples/jsm/nodes/accessors/MaterialNode.js +107 -3
- package/examples/jsm/nodes/accessors/StorageBufferNode.js +9 -0
- package/examples/jsm/nodes/accessors/TextureNode.js +21 -3
- package/examples/jsm/nodes/accessors/TextureSizeNode.js +1 -1
- package/examples/jsm/nodes/code/FunctionNode.js +0 -8
- package/examples/jsm/nodes/core/Node.js +8 -0
- package/examples/jsm/nodes/core/NodeBuilder.js +5 -9
- package/examples/jsm/nodes/core/OutputStructNode.js +2 -1
- package/examples/jsm/nodes/core/PropertyNode.js +10 -0
- package/examples/jsm/nodes/display/BumpMapNode.js +7 -26
- package/examples/jsm/nodes/display/FrontFacingNode.js +13 -0
- package/examples/jsm/nodes/display/ViewportDepthNode.js +1 -1
- package/examples/jsm/nodes/display/ViewportNode.js +4 -2
- package/examples/jsm/nodes/display/ViewportTextureNode.js +4 -1
- package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +26 -7
- package/examples/jsm/nodes/functions/BSDF/D_GGX_Anisotropic.js +28 -0
- package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +1 -3
- package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +29 -0
- package/examples/jsm/nodes/functions/PhongLightingModel.js +1 -1
- package/examples/jsm/nodes/functions/PhysicalLightingModel.js +164 -10
- package/examples/jsm/nodes/functions/ShadowMaskModel.js +31 -0
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +18 -4
- package/examples/jsm/nodes/lighting/DirectionalLightNode.js +2 -1
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +11 -2
- package/examples/jsm/nodes/lighting/IrradianceNode.js +24 -0
- package/examples/jsm/nodes/lighting/LightsNode.js +11 -1
- package/examples/jsm/nodes/lighting/PointLightNode.js +2 -1
- package/examples/jsm/nodes/lighting/SpotLightNode.js +2 -1
- package/examples/jsm/nodes/materials/Line2NodeMaterial.js +10 -6
- package/examples/jsm/nodes/materials/Materials.js +1 -0
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +0 -2
- package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +2 -2
- package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +76 -5
- package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +11 -4
- package/examples/jsm/nodes/materials/NodeMaterial.js +31 -41
- package/examples/jsm/nodes/materials/ShadowNodeMaterial.js +34 -0
- package/examples/jsm/nodes/pmrem/PMREMUtils.js +1 -1
- package/examples/jsm/nodes/shadernode/ShaderNode.js +2 -8
- package/examples/jsm/physics/JoltPhysics.js +281 -0
- package/examples/jsm/postprocessing/RenderTransitionPass.js +193 -0
- package/examples/jsm/renderers/common/Background.js +3 -3
- package/examples/jsm/renderers/common/ClippingContext.js +1 -1
- package/examples/jsm/renderers/common/RenderList.js +1 -1
- package/examples/jsm/renderers/common/RenderObject.js +43 -1
- package/examples/jsm/renderers/common/Renderer.js +129 -14
- package/examples/jsm/renderers/common/Textures.js +1 -1
- package/examples/jsm/renderers/common/extras/PMREMGenerator.js +13 -17
- package/examples/jsm/renderers/common/nodes/Nodes.js +31 -47
- package/examples/jsm/renderers/webgl/WebGLBackend.js +7 -21
- package/examples/jsm/renderers/webgl/WebGLBufferRenderer.js +5 -1
- package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +6 -0
- package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +21 -7
- package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +3 -21
- package/examples/jsm/renderers/webgpu/WebGPUBackend.js +33 -45
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +16 -1
- package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +4 -1
- package/examples/jsm/transpiler/GLSLDecoder.js +1 -1
- package/examples/jsm/transpiler/ShaderToyDecoder.js +1 -1
- package/examples/jsm/utils/SceneUtils.js +60 -1
- package/examples/jsm/webxr/OculusHandModel.js +3 -2
- package/examples/jsm/webxr/XRHandModelFactory.js +4 -2
- package/package.json +1 -1
- package/src/constants.js +1 -1
- package/src/core/RenderTarget.js +8 -0
- package/src/extras/PMREMGenerator.js +12 -11
- package/src/loaders/FileLoader.js +1 -1
- package/src/loaders/MaterialLoader.js +1 -0
- package/src/materials/Material.js +2 -0
- package/src/materials/MeshPhysicalMaterial.js +20 -0
- package/src/objects/BatchedMesh.js +23 -0
- package/src/objects/Line.js +66 -43
- package/src/renderers/WebGLRenderer.js +92 -61
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +1 -0
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +17 -9
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +47 -13
- package/src/renderers/shaders/ShaderChunk.js +0 -2
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +4 -0
- package/src/renderers/shaders/ShaderLib.js +1 -0
- package/src/renderers/webgl/WebGLBackground.js +18 -3
- package/src/renderers/webgl/WebGLBufferRenderer.js +36 -0
- package/src/renderers/webgl/WebGLCapabilities.js +33 -1
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +36 -0
- package/src/renderers/webgl/WebGLMaterials.js +6 -0
- package/src/renderers/webgl/WebGLProgram.js +3 -5
- package/src/renderers/webgl/WebGLPrograms.js +5 -0
- package/src/renderers/webgl/WebGLRenderStates.js +6 -2
- package/src/renderers/webgl/WebGLShadowMap.js +25 -25
- package/src/renderers/webgl/WebGLTextures.js +68 -60
- package/src/renderers/webgl/WebGLUtils.js +3 -21
- package/src/renderers/webxr/WebXRManager.js +2 -4
- package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +0 -318
- package/examples/jsm/renderers/webgl-legacy/nodes/SlotNode.js +0 -26
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +0 -792
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.js +0 -51
- package/src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl.js +0 -10
|
@@ -361,7 +361,8 @@ class WebXRManager extends EventDispatcher {
|
|
|
361
361
|
depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),
|
|
362
362
|
stencilBuffer: attributes.stencil,
|
|
363
363
|
colorSpace: renderer.outputColorSpace,
|
|
364
|
-
samples: attributes.antialias ? 4 : 0
|
|
364
|
+
samples: attributes.antialias ? 4 : 0,
|
|
365
|
+
resolveDepthBuffer: ( glProjLayer.ignoreDepthValues === false )
|
|
365
366
|
};
|
|
366
367
|
|
|
367
368
|
if ( scope.isMultiview ) {
|
|
@@ -381,9 +382,6 @@ class WebXRManager extends EventDispatcher {
|
|
|
381
382
|
|
|
382
383
|
}
|
|
383
384
|
|
|
384
|
-
const renderTargetProperties = renderer.properties.get( newRenderTarget );
|
|
385
|
-
renderTargetProperties.__ignoreDepthValues = glProjLayer.ignoreDepthValues;
|
|
386
|
-
|
|
387
385
|
}
|
|
388
386
|
|
|
389
387
|
newRenderTarget.isXRRenderTarget = true; // TODO Remove this when possible, see #23278
|
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
import { MathNode, GLSLNodeParser, NodeBuilder } from '../../../nodes/Nodes.js';
|
|
2
|
-
|
|
3
|
-
const glslMethods = {
|
|
4
|
-
[ MathNode.ATAN2 ]: 'atan'
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
const precisionLib = {
|
|
8
|
-
low: 'lowp',
|
|
9
|
-
medium: 'mediump',
|
|
10
|
-
high: 'highp'
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
class GLSL1NodeBuilder extends NodeBuilder {
|
|
14
|
-
|
|
15
|
-
constructor( object, renderer, scene = null ) {
|
|
16
|
-
|
|
17
|
-
super( object, renderer, new GLSLNodeParser(), scene );
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
getMethod( method ) {
|
|
22
|
-
|
|
23
|
-
return glslMethods[ method ] || method;
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
getTexture( texture, textureProperty, uvSnippet ) {
|
|
28
|
-
|
|
29
|
-
if ( texture.isTextureCube ) {
|
|
30
|
-
|
|
31
|
-
return `textureCube( ${textureProperty}, ${uvSnippet} )`;
|
|
32
|
-
|
|
33
|
-
} else {
|
|
34
|
-
|
|
35
|
-
return `texture2D( ${textureProperty}, ${uvSnippet} )`;
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
getTextureBias( texture, textureProperty, uvSnippet, biasSnippet ) {
|
|
42
|
-
|
|
43
|
-
return `textureLod( ${textureProperty}, ${uvSnippet}, ${biasSnippet} )`;
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
getVars( shaderStage ) {
|
|
48
|
-
|
|
49
|
-
const snippets = [];
|
|
50
|
-
|
|
51
|
-
const vars = this.vars[ shaderStage ];
|
|
52
|
-
|
|
53
|
-
for ( const variable of vars ) {
|
|
54
|
-
|
|
55
|
-
snippets.push( `${ this.getVar( variable.type, variable.name ) };` );
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return snippets.join( '\n\t' );
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
getUniforms( shaderStage ) {
|
|
64
|
-
|
|
65
|
-
const uniforms = this.uniforms[ shaderStage ];
|
|
66
|
-
|
|
67
|
-
let output = '';
|
|
68
|
-
|
|
69
|
-
for ( const uniform of uniforms ) {
|
|
70
|
-
|
|
71
|
-
let snippet = null;
|
|
72
|
-
|
|
73
|
-
if ( uniform.type === 'texture' ) {
|
|
74
|
-
|
|
75
|
-
snippet = `sampler2D ${uniform.name};\n`;
|
|
76
|
-
|
|
77
|
-
} else if ( uniform.type === 'cubeTexture' ) {
|
|
78
|
-
|
|
79
|
-
snippet = `samplerCube ${uniform.name};\n`;
|
|
80
|
-
|
|
81
|
-
} else {
|
|
82
|
-
|
|
83
|
-
const vectorType = this.getVectorType( uniform.type );
|
|
84
|
-
|
|
85
|
-
snippet = `${vectorType} ${uniform.name};\n`;
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const precision = uniform.node.precision;
|
|
90
|
-
|
|
91
|
-
if ( precision !== null ) {
|
|
92
|
-
|
|
93
|
-
snippet = 'uniform ' + precisionLib[ precision ] + ' ' + snippet;
|
|
94
|
-
|
|
95
|
-
} else {
|
|
96
|
-
|
|
97
|
-
snippet = 'uniform ' + snippet;
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
output += snippet;
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return output;
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
getAttributes( shaderStage ) {
|
|
110
|
-
|
|
111
|
-
let snippet = '';
|
|
112
|
-
|
|
113
|
-
if ( shaderStage === 'vertex' ) {
|
|
114
|
-
|
|
115
|
-
const attributes = this.attributes;
|
|
116
|
-
|
|
117
|
-
for ( const attribute of attributes ) {
|
|
118
|
-
|
|
119
|
-
snippet += `attribute ${attribute.type} ${attribute.name};\n`;
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return snippet;
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
getVaryings( shaderStage ) {
|
|
130
|
-
|
|
131
|
-
let snippet = '';
|
|
132
|
-
|
|
133
|
-
const varyings = this.varyings;
|
|
134
|
-
|
|
135
|
-
if ( shaderStage === 'vertex' ) {
|
|
136
|
-
|
|
137
|
-
for ( const varying of varyings ) {
|
|
138
|
-
|
|
139
|
-
snippet += `${varying.needsInterpolation ? 'varying' : '/*varying*/'} ${varying.type} ${varying.name};\n`;
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
} else if ( shaderStage === 'fragment' ) {
|
|
144
|
-
|
|
145
|
-
for ( const varying of varyings ) {
|
|
146
|
-
|
|
147
|
-
if ( varying.needsInterpolation ) {
|
|
148
|
-
|
|
149
|
-
snippet += `varying ${varying.type} ${varying.name};\n`;
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return snippet;
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
getVertexIndex() {
|
|
162
|
-
|
|
163
|
-
return 'gl_VertexID';
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
getFrontFacing() {
|
|
168
|
-
|
|
169
|
-
return 'gl_FrontFacing';
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
getFragCoord() {
|
|
174
|
-
|
|
175
|
-
return 'gl_FragCoord';
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
isFlipY() {
|
|
180
|
-
|
|
181
|
-
return true;
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
_getGLSLVertexCode( shaderData ) {
|
|
186
|
-
|
|
187
|
-
return `${ this.getSignature() }
|
|
188
|
-
|
|
189
|
-
// uniforms
|
|
190
|
-
${shaderData.uniforms}
|
|
191
|
-
|
|
192
|
-
// varyings
|
|
193
|
-
${shaderData.varyings}
|
|
194
|
-
|
|
195
|
-
// attributes
|
|
196
|
-
${shaderData.attributes}
|
|
197
|
-
|
|
198
|
-
// codes
|
|
199
|
-
${shaderData.codes}
|
|
200
|
-
|
|
201
|
-
void main() {
|
|
202
|
-
|
|
203
|
-
// vars
|
|
204
|
-
${shaderData.vars}
|
|
205
|
-
|
|
206
|
-
// flow
|
|
207
|
-
${shaderData.flow}
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
`;
|
|
211
|
-
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
_getGLSLFragmentCode( shaderData ) {
|
|
215
|
-
|
|
216
|
-
return `${ this.getSignature() }
|
|
217
|
-
|
|
218
|
-
// precision
|
|
219
|
-
precision highp float;
|
|
220
|
-
precision highp int;
|
|
221
|
-
|
|
222
|
-
// uniforms
|
|
223
|
-
${shaderData.uniforms}
|
|
224
|
-
|
|
225
|
-
// varyings
|
|
226
|
-
${shaderData.varyings}
|
|
227
|
-
|
|
228
|
-
// codes
|
|
229
|
-
${shaderData.codes}
|
|
230
|
-
|
|
231
|
-
void main() {
|
|
232
|
-
|
|
233
|
-
// vars
|
|
234
|
-
${shaderData.vars}
|
|
235
|
-
|
|
236
|
-
// flow
|
|
237
|
-
${shaderData.flow}
|
|
238
|
-
|
|
239
|
-
}
|
|
240
|
-
`;
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
buildCode() {
|
|
245
|
-
|
|
246
|
-
const shadersData = this.material !== null ? { fragment: {}, vertex: {} } : { compute: {} };
|
|
247
|
-
|
|
248
|
-
for ( const shaderStage in shadersData ) {
|
|
249
|
-
|
|
250
|
-
let flow = '// code\n\n';
|
|
251
|
-
flow += this.flowCode[ shaderStage ];
|
|
252
|
-
|
|
253
|
-
const flowNodes = this.flowNodes[ shaderStage ];
|
|
254
|
-
const mainNode = flowNodes[ flowNodes.length - 1 ];
|
|
255
|
-
|
|
256
|
-
for ( const node of flowNodes ) {
|
|
257
|
-
|
|
258
|
-
const flowSlotData = this.getFlowData( node/*, shaderStage*/ );
|
|
259
|
-
const slotName = node.name;
|
|
260
|
-
|
|
261
|
-
if ( slotName ) {
|
|
262
|
-
|
|
263
|
-
if ( flow.length > 0 ) flow += '\n';
|
|
264
|
-
|
|
265
|
-
flow += `\t// flow -> ${ slotName }\n\t`;
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
flow += `${ flowSlotData.code }\n\t`;
|
|
270
|
-
|
|
271
|
-
if ( node === mainNode && shaderStage !== 'compute' ) {
|
|
272
|
-
|
|
273
|
-
flow += '// result\n\t';
|
|
274
|
-
|
|
275
|
-
if ( shaderStage === 'vertex' ) {
|
|
276
|
-
|
|
277
|
-
flow += 'gl_Position = ';
|
|
278
|
-
|
|
279
|
-
} else if ( shaderStage === 'fragment' ) {
|
|
280
|
-
|
|
281
|
-
flow += 'gl_FragColor = ';
|
|
282
|
-
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
flow += `${ flowSlotData.result };`;
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
const stageData = shadersData[ shaderStage ];
|
|
292
|
-
|
|
293
|
-
stageData.uniforms = this.getUniforms( shaderStage );
|
|
294
|
-
stageData.attributes = this.getAttributes( shaderStage );
|
|
295
|
-
stageData.varyings = this.getVaryings( shaderStage );
|
|
296
|
-
stageData.vars = this.getVars( shaderStage );
|
|
297
|
-
stageData.codes = this.getCodes( shaderStage );
|
|
298
|
-
stageData.flow = flow;
|
|
299
|
-
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
if ( this.material !== null ) {
|
|
303
|
-
|
|
304
|
-
this.vertexShader = this._getGLSLVertexCode( shadersData.vertex );
|
|
305
|
-
this.fragmentShader = this._getGLSLFragmentCode( shadersData.fragment );
|
|
306
|
-
|
|
307
|
-
} else {
|
|
308
|
-
|
|
309
|
-
console.warn( 'GLSLNodeBuilder: compute shaders are not supported.' );
|
|
310
|
-
//this.computeShader = this._getGLSLComputeCode( shadersData.compute );
|
|
311
|
-
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
export default GLSL1NodeBuilder;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Node } from '../../../nodes/Nodes.js';
|
|
2
|
-
|
|
3
|
-
class SlotNode extends Node {
|
|
4
|
-
|
|
5
|
-
constructor( params ) {
|
|
6
|
-
|
|
7
|
-
super( params.nodeType );
|
|
8
|
-
|
|
9
|
-
this.node = null;
|
|
10
|
-
this.source = null;
|
|
11
|
-
this.target = null;
|
|
12
|
-
this.inclusionType = 'replace';
|
|
13
|
-
|
|
14
|
-
Object.assign( this, params );
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
generate( builder ) {
|
|
19
|
-
|
|
20
|
-
return this.node.build( builder, this.getNodeType( builder ) );
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export default SlotNode;
|