super-three 0.154.1 → 0.155.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 +256 -38
- package/build/three.js +256 -38
- package/build/three.min.js +1 -1
- package/build/three.module.js +255 -39
- package/build/three.module.min.js +1 -1
- package/examples/jsm/controls/OrbitControls.js +143 -21
- package/examples/jsm/environments/RoomEnvironment.js +1 -1
- package/examples/jsm/exporters/USDZExporter.js +1 -0
- package/examples/jsm/interactive/SelectionHelper.js +7 -0
- package/examples/jsm/loaders/FBXLoader.js +1 -1
- package/examples/jsm/loaders/GLTFLoader.js +8 -3
- package/examples/jsm/loaders/KTX2Loader.js +4 -4
- package/examples/jsm/loaders/LDrawLoader.js +1 -1
- package/examples/jsm/loaders/NRRDLoader.js +3 -3
- package/examples/jsm/loaders/PLYLoader.js +1 -1
- package/examples/jsm/loaders/TGALoader.js +10 -10
- package/examples/jsm/loaders/VRMLLoader.js +1 -1
- package/examples/jsm/misc/GPUComputationRenderer.js +0 -9
- package/examples/jsm/misc/Volume.js +4 -6
- package/examples/jsm/nodes/Nodes.js +5 -6
- package/examples/jsm/nodes/accessors/BufferAttributeNode.js +1 -1
- package/examples/jsm/nodes/accessors/CubeTextureNode.js +2 -0
- package/examples/jsm/nodes/accessors/ExtendedMaterialNode.js +14 -1
- package/examples/jsm/nodes/accessors/InstanceNode.js +8 -8
- package/examples/jsm/nodes/accessors/MaterialNode.js +34 -44
- package/examples/jsm/nodes/accessors/SceneNode.js +6 -0
- package/examples/jsm/nodes/accessors/TextureNode.js +48 -7
- package/examples/jsm/nodes/core/LightingModel.js +7 -9
- package/examples/jsm/nodes/core/Node.js +11 -2
- package/examples/jsm/nodes/core/PropertyNode.js +4 -0
- package/examples/jsm/nodes/display/BumpMapNode.js +77 -0
- package/examples/jsm/nodes/display/NormalMapNode.js +2 -2
- package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +10 -2
- package/examples/jsm/nodes/functions/BSDF/Schlick_to_F0.js +13 -0
- package/examples/jsm/nodes/functions/PhongLightingModel.js +53 -14
- package/examples/jsm/nodes/functions/PhysicalLightingModel.js +236 -97
- package/examples/jsm/nodes/geometry/RangeNode.js +2 -2
- package/examples/jsm/nodes/gpgpu/ComputeNode.js +13 -0
- package/examples/jsm/nodes/lighting/AONode.js +1 -1
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +58 -20
- package/examples/jsm/nodes/lighting/DirectionalLightNode.js +7 -10
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +22 -12
- package/examples/jsm/nodes/lighting/HemisphereLightNode.js +1 -1
- package/examples/jsm/nodes/lighting/LightingContextNode.js +12 -9
- package/examples/jsm/nodes/lighting/PointLightNode.js +7 -10
- package/examples/jsm/nodes/lighting/SpotLightNode.js +7 -10
- package/examples/jsm/nodes/materials/Materials.js +1 -0
- package/examples/jsm/nodes/materials/MeshLambertNodeMaterial.js +34 -0
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +2 -0
- package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +2 -2
- package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +19 -2
- package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +2 -2
- package/examples/jsm/nodes/materials/NodeMaterial.js +50 -24
- package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +2 -2
- package/examples/jsm/nodes/shadernode/ShaderNode.js +2 -2
- package/examples/jsm/objects/Reflector.js +1 -9
- package/examples/jsm/objects/Refractor.js +0 -8
- package/examples/jsm/offscreen/scene.js +0 -1
- package/examples/jsm/postprocessing/MaskPass.js +4 -1
- package/examples/jsm/postprocessing/OutputPass.js +33 -14
- package/examples/jsm/postprocessing/UnrealBloomPass.js +21 -17
- package/examples/jsm/renderers/common/Background.js +22 -20
- package/examples/jsm/renderers/common/Binding.js +8 -0
- package/examples/jsm/renderers/common/Bindings.js +2 -6
- package/examples/jsm/renderers/common/Geometries.js +1 -1
- package/examples/jsm/renderers/common/Pipelines.js +94 -45
- package/examples/jsm/renderers/common/RenderContext.js +1 -0
- package/examples/jsm/renderers/common/RenderContexts.js +16 -5
- package/examples/jsm/renderers/common/RenderObject.js +20 -4
- package/examples/jsm/renderers/common/RenderObjects.js +10 -7
- package/examples/jsm/renderers/common/Renderer.js +70 -39
- package/examples/jsm/renderers/common/Textures.js +20 -8
- package/examples/jsm/renderers/common/nodes/Nodes.js +15 -4
- package/examples/jsm/renderers/webgpu/WebGPUBackend.js +51 -54
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +33 -9
- package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +55 -36
- package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +83 -5
- package/examples/jsm/renderers/webgpu/utils/WebGPUConstants.js +24 -22
- package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +83 -130
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +35 -8
- package/examples/jsm/renderers/webgpu/utils/WebGPUUtils.js +1 -1
- package/examples/jsm/shaders/OutputShader.js +19 -2
- package/examples/jsm/utils/BufferGeometryUtils.js +13 -4
- package/examples/jsm/webxr/OculusHandPointerModel.js +2 -2
- package/package.json +2 -2
- package/src/Three.js +2 -0
- package/src/animation/PropertyBinding.js +1 -1
- package/src/cameras/CubeCamera.js +1 -4
- package/src/constants.js +1 -1
- package/src/core/BufferAttribute.js +20 -0
- package/src/core/Object3D.js +1 -1
- package/src/core/RenderTarget.js +122 -0
- package/src/geometries/CapsuleGeometry.js +1 -1
- package/src/loaders/DataTextureLoader.js +21 -2
- package/src/renderers/WebGLMultipleRenderTargets.js +0 -2
- package/src/renderers/WebGLRenderTarget.js +3 -110
- package/src/renderers/WebGLRenderer.js +62 -8
- package/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.js +1 -2
- package/src/renderers/webgl/WebGLGeometries.js +5 -1
- package/src/renderers/webgl/WebGLMaterials.js +1 -1
- package/src/renderers/webgl/WebGLPrograms.js +14 -2
- package/src/renderers/webgl/WebGLTextures.js +97 -12
- package/src/textures/CompressedCubeTexture.js +19 -0
- package/examples/jsm/nodes/functions/BSDF/BRDF_BlinnPhong.js +0 -30
- package/examples/jsm/renderers/common/RenderTarget.js +0 -15
- package/examples/jsm/renderers/common/nodes/NodeRender.js +0 -302
|
@@ -5,7 +5,10 @@ import {
|
|
|
5
5
|
Spherical,
|
|
6
6
|
TOUCH,
|
|
7
7
|
Vector2,
|
|
8
|
-
Vector3
|
|
8
|
+
Vector3,
|
|
9
|
+
Plane,
|
|
10
|
+
Ray,
|
|
11
|
+
MathUtils
|
|
9
12
|
} from 'three';
|
|
10
13
|
|
|
11
14
|
// OrbitControls performs orbiting, dollying (zooming), and panning.
|
|
@@ -18,6 +21,9 @@ import {
|
|
|
18
21
|
const _changeEvent = { type: 'change' };
|
|
19
22
|
const _startEvent = { type: 'start' };
|
|
20
23
|
const _endEvent = { type: 'end' };
|
|
24
|
+
const _ray = new Ray();
|
|
25
|
+
const _plane = new Plane();
|
|
26
|
+
const TILT_LIMIT = Math.cos( 70 * MathUtils.DEG2RAD );
|
|
21
27
|
|
|
22
28
|
class OrbitControls extends EventDispatcher {
|
|
23
29
|
|
|
@@ -72,6 +78,7 @@ class OrbitControls extends EventDispatcher {
|
|
|
72
78
|
this.panSpeed = 1.0;
|
|
73
79
|
this.screenSpacePanning = true; // if false, pan orthogonal to world-space direction camera.up
|
|
74
80
|
this.keyPanSpeed = 7.0; // pixels moved per arrow key push
|
|
81
|
+
this.zoomToCursor = false;
|
|
75
82
|
|
|
76
83
|
// Set to true to automatically rotate around the target
|
|
77
84
|
// If auto-rotate is enabled, you must call controls.update() in your animation loop
|
|
@@ -230,11 +237,6 @@ class OrbitControls extends EventDispatcher {
|
|
|
230
237
|
spherical.makeSafe();
|
|
231
238
|
|
|
232
239
|
|
|
233
|
-
spherical.radius *= scale;
|
|
234
|
-
|
|
235
|
-
// restrict radius to be between desired limits
|
|
236
|
-
spherical.radius = Math.max( scope.minDistance, Math.min( scope.maxDistance, spherical.radius ) );
|
|
237
|
-
|
|
238
240
|
// move target to panned location
|
|
239
241
|
|
|
240
242
|
if ( scope.enableDamping === true ) {
|
|
@@ -247,6 +249,19 @@ class OrbitControls extends EventDispatcher {
|
|
|
247
249
|
|
|
248
250
|
}
|
|
249
251
|
|
|
252
|
+
// adjust the camera position based on zoom only if we're not zooming to the cursor or if it's an ortho camera
|
|
253
|
+
// we adjust zoom later in these cases
|
|
254
|
+
if ( scope.zoomToCursor && performCursorZoom || scope.object.isOrthographicCamera ) {
|
|
255
|
+
|
|
256
|
+
spherical.radius = clampDistance( spherical.radius );
|
|
257
|
+
|
|
258
|
+
} else {
|
|
259
|
+
|
|
260
|
+
spherical.radius = clampDistance( spherical.radius * scale );
|
|
261
|
+
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
|
|
250
265
|
offset.setFromSpherical( spherical );
|
|
251
266
|
|
|
252
267
|
// rotate offset back to "camera-up-vector-is-up" space
|
|
@@ -271,7 +286,91 @@ class OrbitControls extends EventDispatcher {
|
|
|
271
286
|
|
|
272
287
|
}
|
|
273
288
|
|
|
289
|
+
// adjust camera position
|
|
290
|
+
let zoomChanged = false;
|
|
291
|
+
if ( scope.zoomToCursor && performCursorZoom ) {
|
|
292
|
+
|
|
293
|
+
let newRadius = null;
|
|
294
|
+
if ( scope.object.isPerspectiveCamera ) {
|
|
295
|
+
|
|
296
|
+
// move the camera down the pointer ray
|
|
297
|
+
// this method avoids floating point error
|
|
298
|
+
const prevRadius = offset.length();
|
|
299
|
+
newRadius = clampDistance( prevRadius * scale );
|
|
300
|
+
|
|
301
|
+
const radiusDelta = prevRadius - newRadius;
|
|
302
|
+
scope.object.position.addScaledVector( dollyDirection, radiusDelta );
|
|
303
|
+
scope.object.updateMatrixWorld();
|
|
304
|
+
|
|
305
|
+
} else if ( scope.object.isOrthographicCamera ) {
|
|
306
|
+
|
|
307
|
+
// adjust the ortho camera position based on zoom changes
|
|
308
|
+
const mouseBefore = new Vector3( mouse.x, mouse.y, 0 );
|
|
309
|
+
mouseBefore.unproject( scope.object );
|
|
310
|
+
|
|
311
|
+
scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / scale ) );
|
|
312
|
+
scope.object.updateProjectionMatrix();
|
|
313
|
+
zoomChanged = true;
|
|
314
|
+
|
|
315
|
+
const mouseAfter = new Vector3( mouse.x, mouse.y, 0 );
|
|
316
|
+
mouseAfter.unproject( scope.object );
|
|
317
|
+
|
|
318
|
+
scope.object.position.sub( mouseAfter ).add( mouseBefore );
|
|
319
|
+
scope.object.updateMatrixWorld();
|
|
320
|
+
|
|
321
|
+
newRadius = offset.length();
|
|
322
|
+
|
|
323
|
+
} else {
|
|
324
|
+
|
|
325
|
+
console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled.' );
|
|
326
|
+
scope.zoomToCursor = false;
|
|
327
|
+
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// handle the placement of the target
|
|
331
|
+
if ( newRadius !== null ) {
|
|
332
|
+
|
|
333
|
+
if ( this.screenSpacePanning ) {
|
|
334
|
+
|
|
335
|
+
// position the orbit target in front of the new camera position
|
|
336
|
+
scope.target.set( 0, 0, - 1 )
|
|
337
|
+
.transformDirection( scope.object.matrix )
|
|
338
|
+
.multiplyScalar( newRadius )
|
|
339
|
+
.add( scope.object.position );
|
|
340
|
+
|
|
341
|
+
} else {
|
|
342
|
+
|
|
343
|
+
// get the ray and translation plane to compute target
|
|
344
|
+
_ray.origin.copy( scope.object.position );
|
|
345
|
+
_ray.direction.set( 0, 0, - 1 ).transformDirection( scope.object.matrix );
|
|
346
|
+
|
|
347
|
+
// if the camera is 20 degrees above the horizon then don't adjust the focus target to avoid
|
|
348
|
+
// extremely large values
|
|
349
|
+
if ( Math.abs( scope.object.up.dot( _ray.direction ) ) < TILT_LIMIT ) {
|
|
350
|
+
|
|
351
|
+
object.lookAt( scope.target );
|
|
352
|
+
|
|
353
|
+
} else {
|
|
354
|
+
|
|
355
|
+
_plane.setFromNormalAndCoplanarPoint( scope.object.up, scope.target );
|
|
356
|
+
_ray.intersectPlane( _plane, scope.target );
|
|
357
|
+
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
} else if ( scope.object.isOrthographicCamera ) {
|
|
365
|
+
|
|
366
|
+
scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / scale ) );
|
|
367
|
+
scope.object.updateProjectionMatrix();
|
|
368
|
+
zoomChanged = true;
|
|
369
|
+
|
|
370
|
+
}
|
|
371
|
+
|
|
274
372
|
scale = 1;
|
|
373
|
+
performCursorZoom = false;
|
|
275
374
|
|
|
276
375
|
// update condition is:
|
|
277
376
|
// min(camera displacement, camera rotation in radians)^2 > EPS
|
|
@@ -350,7 +449,6 @@ class OrbitControls extends EventDispatcher {
|
|
|
350
449
|
|
|
351
450
|
let scale = 1;
|
|
352
451
|
const panOffset = new Vector3();
|
|
353
|
-
let zoomChanged = false;
|
|
354
452
|
|
|
355
453
|
const rotateStart = new Vector2();
|
|
356
454
|
const rotateEnd = new Vector2();
|
|
@@ -364,6 +462,10 @@ class OrbitControls extends EventDispatcher {
|
|
|
364
462
|
const dollyEnd = new Vector2();
|
|
365
463
|
const dollyDelta = new Vector2();
|
|
366
464
|
|
|
465
|
+
const dollyDirection = new Vector3();
|
|
466
|
+
const mouse = new Vector2();
|
|
467
|
+
let performCursorZoom = false;
|
|
468
|
+
|
|
367
469
|
const pointers = [];
|
|
368
470
|
const pointerPositions = {};
|
|
369
471
|
|
|
@@ -474,16 +576,10 @@ class OrbitControls extends EventDispatcher {
|
|
|
474
576
|
|
|
475
577
|
function dollyOut( dollyScale ) {
|
|
476
578
|
|
|
477
|
-
if ( scope.object.isPerspectiveCamera ) {
|
|
579
|
+
if ( scope.object.isPerspectiveCamera || scope.object.isOrthographicCamera ) {
|
|
478
580
|
|
|
479
581
|
scale /= dollyScale;
|
|
480
582
|
|
|
481
|
-
} else if ( scope.object.isOrthographicCamera ) {
|
|
482
|
-
|
|
483
|
-
scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom * dollyScale ) );
|
|
484
|
-
scope.object.updateProjectionMatrix();
|
|
485
|
-
zoomChanged = true;
|
|
486
|
-
|
|
487
583
|
} else {
|
|
488
584
|
|
|
489
585
|
console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
|
|
@@ -495,16 +591,10 @@ class OrbitControls extends EventDispatcher {
|
|
|
495
591
|
|
|
496
592
|
function dollyIn( dollyScale ) {
|
|
497
593
|
|
|
498
|
-
if ( scope.object.isPerspectiveCamera ) {
|
|
594
|
+
if ( scope.object.isPerspectiveCamera || scope.object.isOrthographicCamera ) {
|
|
499
595
|
|
|
500
596
|
scale *= dollyScale;
|
|
501
597
|
|
|
502
|
-
} else if ( scope.object.isOrthographicCamera ) {
|
|
503
|
-
|
|
504
|
-
scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / dollyScale ) );
|
|
505
|
-
scope.object.updateProjectionMatrix();
|
|
506
|
-
zoomChanged = true;
|
|
507
|
-
|
|
508
598
|
} else {
|
|
509
599
|
|
|
510
600
|
console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
|
|
@@ -514,6 +604,35 @@ class OrbitControls extends EventDispatcher {
|
|
|
514
604
|
|
|
515
605
|
}
|
|
516
606
|
|
|
607
|
+
function updateMouseParameters( event ) {
|
|
608
|
+
|
|
609
|
+
if ( ! scope.zoomToCursor ) {
|
|
610
|
+
|
|
611
|
+
return;
|
|
612
|
+
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
performCursorZoom = true;
|
|
616
|
+
|
|
617
|
+
const rect = scope.domElement.getBoundingClientRect();
|
|
618
|
+
const x = event.clientX - rect.left;
|
|
619
|
+
const y = event.clientY - rect.top;
|
|
620
|
+
const w = rect.width;
|
|
621
|
+
const h = rect.height;
|
|
622
|
+
|
|
623
|
+
mouse.x = ( x / w ) * 2 - 1;
|
|
624
|
+
mouse.y = - ( y / h ) * 2 + 1;
|
|
625
|
+
|
|
626
|
+
dollyDirection.set( mouse.x, mouse.y, 1 ).unproject( object ).sub( object.position ).normalize();
|
|
627
|
+
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
function clampDistance( dist ) {
|
|
631
|
+
|
|
632
|
+
return Math.max( scope.minDistance, Math.min( scope.maxDistance, dist ) );
|
|
633
|
+
|
|
634
|
+
}
|
|
635
|
+
|
|
517
636
|
//
|
|
518
637
|
// event callbacks - update the object state
|
|
519
638
|
//
|
|
@@ -526,6 +645,7 @@ class OrbitControls extends EventDispatcher {
|
|
|
526
645
|
|
|
527
646
|
function handleMouseDownDolly( event ) {
|
|
528
647
|
|
|
648
|
+
updateMouseParameters( event );
|
|
529
649
|
dollyStart.set( event.clientX, event.clientY );
|
|
530
650
|
|
|
531
651
|
}
|
|
@@ -592,6 +712,8 @@ class OrbitControls extends EventDispatcher {
|
|
|
592
712
|
|
|
593
713
|
function handleMouseWheel( event ) {
|
|
594
714
|
|
|
715
|
+
updateMouseParameters( event );
|
|
716
|
+
|
|
595
717
|
if ( event.deltaY < 0 ) {
|
|
596
718
|
|
|
597
719
|
dollyIn( getZoomScale() );
|
|
@@ -26,7 +26,7 @@ class RoomEnvironment extends Scene {
|
|
|
26
26
|
|
|
27
27
|
let intensity = 5;
|
|
28
28
|
|
|
29
|
-
if ( renderer !== null && renderer.
|
|
29
|
+
if ( renderer !== null && renderer._useLegacyLights === false ) intensity = 900;
|
|
30
30
|
|
|
31
31
|
const mainLight = new PointLight( 0xffffff, intensity, 28, 2 );
|
|
32
32
|
mainLight.position.set( 0.418, 16.199, 0.300 );
|
|
@@ -15,9 +15,12 @@ class SelectionHelper {
|
|
|
15
15
|
this.pointBottomRight = new Vector2();
|
|
16
16
|
|
|
17
17
|
this.isDown = false;
|
|
18
|
+
this.enabled = true;
|
|
18
19
|
|
|
19
20
|
this.onPointerDown = function ( event ) {
|
|
20
21
|
|
|
22
|
+
if ( this.enabled === false ) return;
|
|
23
|
+
|
|
21
24
|
this.isDown = true;
|
|
22
25
|
this.onSelectStart( event );
|
|
23
26
|
|
|
@@ -25,6 +28,8 @@ class SelectionHelper {
|
|
|
25
28
|
|
|
26
29
|
this.onPointerMove = function ( event ) {
|
|
27
30
|
|
|
31
|
+
if ( this.enabled === false ) return;
|
|
32
|
+
|
|
28
33
|
if ( this.isDown ) {
|
|
29
34
|
|
|
30
35
|
this.onSelectMove( event );
|
|
@@ -35,6 +40,8 @@ class SelectionHelper {
|
|
|
35
40
|
|
|
36
41
|
this.onPointerUp = function ( ) {
|
|
37
42
|
|
|
43
|
+
if ( this.enabled === false ) return;
|
|
44
|
+
|
|
38
45
|
this.isDown = false;
|
|
39
46
|
this.onSelectOver();
|
|
40
47
|
|
|
@@ -3918,7 +3918,6 @@ class GLTFParser {
|
|
|
3918
3918
|
if ( node.updateMatrix ) {
|
|
3919
3919
|
|
|
3920
3920
|
node.updateMatrix();
|
|
3921
|
-
node.matrixAutoUpdate = true;
|
|
3922
3921
|
|
|
3923
3922
|
}
|
|
3924
3923
|
|
|
@@ -4267,7 +4266,6 @@ class GLTFParser {
|
|
|
4267
4266
|
const tracks = [];
|
|
4268
4267
|
|
|
4269
4268
|
const targetName = node.name ? node.name : node.uuid;
|
|
4270
|
-
|
|
4271
4269
|
const targetNames = [];
|
|
4272
4270
|
|
|
4273
4271
|
if ( PATH_PROPERTIES[ target.path ] === PATH_PROPERTIES.weights ) {
|
|
@@ -4304,7 +4302,12 @@ class GLTFParser {
|
|
|
4304
4302
|
|
|
4305
4303
|
case PATH_PROPERTIES.position:
|
|
4306
4304
|
case PATH_PROPERTIES.scale:
|
|
4305
|
+
|
|
4306
|
+
TypedKeyframeTrack = VectorKeyframeTrack;
|
|
4307
|
+
break;
|
|
4308
|
+
|
|
4307
4309
|
default:
|
|
4310
|
+
|
|
4308
4311
|
switch ( outputAccessor.itemSize ) {
|
|
4309
4312
|
|
|
4310
4313
|
case 1:
|
|
@@ -4312,6 +4315,7 @@ class GLTFParser {
|
|
|
4312
4315
|
break;
|
|
4313
4316
|
case 2:
|
|
4314
4317
|
case 3:
|
|
4318
|
+
default:
|
|
4315
4319
|
TypedKeyframeTrack = VectorKeyframeTrack;
|
|
4316
4320
|
break;
|
|
4317
4321
|
|
|
@@ -4323,6 +4327,7 @@ class GLTFParser {
|
|
|
4323
4327
|
|
|
4324
4328
|
const interpolation = sampler.interpolation !== undefined ? INTERPOLATION[ sampler.interpolation ] : InterpolateLinear;
|
|
4325
4329
|
|
|
4330
|
+
|
|
4326
4331
|
const outputArray = this._getArrayFromAccessor( outputAccessor );
|
|
4327
4332
|
|
|
4328
4333
|
for ( let j = 0, jl = targetNames.length; j < jl; j ++ ) {
|
|
@@ -4335,7 +4340,7 @@ class GLTFParser {
|
|
|
4335
4340
|
);
|
|
4336
4341
|
|
|
4337
4342
|
// Override interpolation with custom factory method.
|
|
4338
|
-
if ( interpolation === 'CUBICSPLINE' ) {
|
|
4343
|
+
if ( sampler.interpolation === 'CUBICSPLINE' ) {
|
|
4339
4344
|
|
|
4340
4345
|
this._createCubicSplineTrackInterpolant( track );
|
|
4341
4346
|
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import {
|
|
15
15
|
CompressedTexture,
|
|
16
16
|
CompressedArrayTexture,
|
|
17
|
+
CompressedCubeTexture,
|
|
17
18
|
Data3DTexture,
|
|
18
19
|
DataTexture,
|
|
19
20
|
FileLoader,
|
|
@@ -261,10 +262,7 @@ class KTX2Loader extends Loader {
|
|
|
261
262
|
|
|
262
263
|
if ( container.faceCount === 6 ) {
|
|
263
264
|
|
|
264
|
-
texture = new
|
|
265
|
-
texture.image = faces;
|
|
266
|
-
texture.format = format;
|
|
267
|
-
texture.type = UnsignedByteType;
|
|
265
|
+
texture = new CompressedCubeTexture( faces, format, UnsignedByteType );
|
|
268
266
|
|
|
269
267
|
} else {
|
|
270
268
|
|
|
@@ -317,12 +315,14 @@ class KTX2Loader extends Loader {
|
|
|
317
315
|
|
|
318
316
|
const texture = mipmaps[ 0 ];
|
|
319
317
|
texture.mipmaps = mipmaps.map( dt => {
|
|
318
|
+
|
|
320
319
|
return {
|
|
321
320
|
data: dt.source.data,
|
|
322
321
|
width: dt.source.data.width,
|
|
323
322
|
height: dt.source.data.height,
|
|
324
323
|
depth: dt.source.data.depth
|
|
325
324
|
};
|
|
325
|
+
|
|
326
326
|
} );
|
|
327
327
|
return texture;
|
|
328
328
|
|
|
@@ -473,10 +473,10 @@ class NRRDLoader extends Loader {
|
|
|
473
473
|
|
|
474
474
|
volume.inverseMatrix = new Matrix4();
|
|
475
475
|
volume.inverseMatrix.copy( volume.matrix ).invert();
|
|
476
|
-
|
|
476
|
+
|
|
477
477
|
volume.RASDimensions = [
|
|
478
|
-
Math.floor( volume.xLength * spacingX ),
|
|
479
|
-
Math.floor( volume.yLength * spacingY ),
|
|
478
|
+
Math.floor( volume.xLength * spacingX ),
|
|
479
|
+
Math.floor( volume.yLength * spacingY ),
|
|
480
480
|
Math.floor( volume.zLength * spacingZ )
|
|
481
481
|
];
|
|
482
482
|
|
|
@@ -706,7 +706,7 @@ class PLYLoader extends Loader {
|
|
|
706
706
|
// ascii section using \r\n as line endings
|
|
707
707
|
if ( hasCRNL === true ) i ++;
|
|
708
708
|
|
|
709
|
-
return { headerText: lines.join( '\r' ) + '\r',
|
|
709
|
+
return { headerText: lines.join( '\r' ) + '\r', headerLength: i };
|
|
710
710
|
|
|
711
711
|
}
|
|
712
712
|
|
|
@@ -25,7 +25,7 @@ class TGALoader extends DataTextureLoader {
|
|
|
25
25
|
case TGA_TYPE_RLE_INDEXED:
|
|
26
26
|
if ( header.colormap_length > 256 || header.colormap_size !== 24 || header.colormap_type !== 1 ) {
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
throw new Error( 'THREE.TGALoader: Invalid type colormap data for indexed type.' );
|
|
29
29
|
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -39,7 +39,7 @@ class TGALoader extends DataTextureLoader {
|
|
|
39
39
|
case TGA_TYPE_RLE_GREY:
|
|
40
40
|
if ( header.colormap_type ) {
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
throw new Error( 'THREE.TGALoader: Invalid type colormap data for colormap type.' );
|
|
43
43
|
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -48,12 +48,12 @@ class TGALoader extends DataTextureLoader {
|
|
|
48
48
|
// What the need of a file without data ?
|
|
49
49
|
|
|
50
50
|
case TGA_TYPE_NO_DATA:
|
|
51
|
-
|
|
51
|
+
throw new Error( 'THREE.TGALoader: No data.' );
|
|
52
52
|
|
|
53
53
|
// Invalid type ?
|
|
54
54
|
|
|
55
55
|
default:
|
|
56
|
-
|
|
56
|
+
throw new Error( 'THREE.TGALoader: Invalid type ' + header.image_type );
|
|
57
57
|
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -61,7 +61,7 @@ class TGALoader extends DataTextureLoader {
|
|
|
61
61
|
|
|
62
62
|
if ( header.width <= 0 || header.height <= 0 ) {
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
throw new Error( 'THREE.TGALoader: Invalid image size.' );
|
|
65
65
|
|
|
66
66
|
}
|
|
67
67
|
|
|
@@ -70,7 +70,7 @@ class TGALoader extends DataTextureLoader {
|
|
|
70
70
|
if ( header.pixel_size !== 8 && header.pixel_size !== 16 &&
|
|
71
71
|
header.pixel_size !== 24 && header.pixel_size !== 32 ) {
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
throw new Error( 'THREE.TGALoader: Invalid pixel size ' + header.pixel_size );
|
|
74
74
|
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -365,7 +365,7 @@ class TGALoader extends DataTextureLoader {
|
|
|
365
365
|
break;
|
|
366
366
|
|
|
367
367
|
default:
|
|
368
|
-
|
|
368
|
+
throw new Error( 'THREE.TGALoader: Format not supported.' );
|
|
369
369
|
break;
|
|
370
370
|
|
|
371
371
|
}
|
|
@@ -391,7 +391,7 @@ class TGALoader extends DataTextureLoader {
|
|
|
391
391
|
break;
|
|
392
392
|
|
|
393
393
|
default:
|
|
394
|
-
|
|
394
|
+
throw new Error( 'THREE.TGALoader: Format not supported.' );
|
|
395
395
|
break;
|
|
396
396
|
|
|
397
397
|
}
|
|
@@ -422,7 +422,7 @@ class TGALoader extends DataTextureLoader {
|
|
|
422
422
|
TGA_ORIGIN_UL = 0x02,
|
|
423
423
|
TGA_ORIGIN_UR = 0x03;
|
|
424
424
|
|
|
425
|
-
if ( buffer.length < 19 )
|
|
425
|
+
if ( buffer.length < 19 ) throw new Error( 'THREE.TGALoader: Not enough data to contain header.' );
|
|
426
426
|
|
|
427
427
|
let offset = 0;
|
|
428
428
|
|
|
@@ -450,7 +450,7 @@ class TGALoader extends DataTextureLoader {
|
|
|
450
450
|
|
|
451
451
|
if ( header.id_length + offset > buffer.length ) {
|
|
452
452
|
|
|
453
|
-
|
|
453
|
+
throw new Error( 'THREE.TGALoader: No data.' );
|
|
454
454
|
|
|
455
455
|
}
|
|
456
456
|
|
|
@@ -960,7 +960,7 @@ class VRMLLoader extends Loader {
|
|
|
960
960
|
|
|
961
961
|
// if the appearance field is NULL or unspecified, lighting is off and the unlit object color is (0, 0, 0)
|
|
962
962
|
|
|
963
|
-
let material = new MeshBasicMaterial( {
|
|
963
|
+
let material = new MeshBasicMaterial( {
|
|
964
964
|
name: Loader.DEFAULT_MATERIAL_NAME,
|
|
965
965
|
color: 0x000000
|
|
966
966
|
} );
|
|
@@ -3,10 +3,8 @@ import {
|
|
|
3
3
|
ClampToEdgeWrapping,
|
|
4
4
|
DataTexture,
|
|
5
5
|
FloatType,
|
|
6
|
-
LinearSRGBColorSpace,
|
|
7
6
|
Mesh,
|
|
8
7
|
NearestFilter,
|
|
9
|
-
NoToneMapping,
|
|
10
8
|
PlaneGeometry,
|
|
11
9
|
RGBAFormat,
|
|
12
10
|
Scene,
|
|
@@ -400,14 +398,9 @@ class GPUComputationRenderer {
|
|
|
400
398
|
|
|
401
399
|
const currentXrEnabled = renderer.xr.enabled;
|
|
402
400
|
const currentShadowAutoUpdate = renderer.shadowMap.autoUpdate;
|
|
403
|
-
const currentOutputColorSpace = renderer.outputColorSpace;
|
|
404
|
-
const currentToneMapping = renderer.toneMapping;
|
|
405
401
|
|
|
406
402
|
renderer.xr.enabled = false; // Avoid camera modification
|
|
407
403
|
renderer.shadowMap.autoUpdate = false; // Avoid re-computing shadows
|
|
408
|
-
renderer.outputColorSpace = LinearSRGBColorSpace;
|
|
409
|
-
renderer.toneMapping = NoToneMapping;
|
|
410
|
-
|
|
411
404
|
mesh.material = material;
|
|
412
405
|
renderer.setRenderTarget( output );
|
|
413
406
|
renderer.render( scene, camera );
|
|
@@ -415,8 +408,6 @@ class GPUComputationRenderer {
|
|
|
415
408
|
|
|
416
409
|
renderer.xr.enabled = currentXrEnabled;
|
|
417
410
|
renderer.shadowMap.autoUpdate = currentShadowAutoUpdate;
|
|
418
|
-
renderer.outputColorSpace = currentOutputColorSpace;
|
|
419
|
-
renderer.toneMapping = currentToneMapping;
|
|
420
411
|
|
|
421
412
|
renderer.setRenderTarget( currentRenderTarget );
|
|
422
413
|
|
|
@@ -340,20 +340,18 @@ class Volume {
|
|
|
340
340
|
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
-
|
|
344
|
-
let iLength, jLength;
|
|
345
|
-
|
|
346
|
-
if( ! this.segmentation ) {
|
|
343
|
+
if ( ! this.segmentation ) {
|
|
347
344
|
|
|
348
345
|
firstDirection.applyMatrix4( volume.inverseMatrix ).normalize();
|
|
349
346
|
secondDirection.applyMatrix4( volume.inverseMatrix ).normalize();
|
|
350
347
|
axisInIJK.applyMatrix4( volume.inverseMatrix ).normalize();
|
|
351
348
|
|
|
352
349
|
}
|
|
350
|
+
|
|
353
351
|
firstDirection.arglet = 'i';
|
|
354
352
|
secondDirection.arglet = 'j';
|
|
355
|
-
iLength = Math.floor( Math.abs( firstDirection.dot( dimensions ) ) );
|
|
356
|
-
jLength = Math.floor( Math.abs( secondDirection.dot( dimensions ) ) );
|
|
353
|
+
const iLength = Math.floor( Math.abs( firstDirection.dot( dimensions ) ) );
|
|
354
|
+
const jLength = Math.floor( Math.abs( secondDirection.dot( dimensions ) ) );
|
|
357
355
|
const planeWidth = Math.abs( iLength * firstSpacing );
|
|
358
356
|
const planeHeight = Math.abs( jLength * secondSpacing );
|
|
359
357
|
|
|
@@ -12,7 +12,7 @@ export { default as CacheNode, cache } from './core/CacheNode.js';
|
|
|
12
12
|
export { default as ConstNode } from './core/ConstNode.js';
|
|
13
13
|
export { default as ContextNode, context, label } from './core/ContextNode.js';
|
|
14
14
|
export { default as IndexNode, vertexIndex, instanceIndex } from './core/IndexNode.js';
|
|
15
|
-
export { default as LightingModel
|
|
15
|
+
export { default as LightingModel } from './core/LightingModel.js';
|
|
16
16
|
export { default as Node, addNodeClass, createNodeFromType } from './core/Node.js';
|
|
17
17
|
export { default as NodeAttribute } from './core/NodeAttribute.js';
|
|
18
18
|
export { default as NodeBuilder } from './core/NodeBuilder.js';
|
|
@@ -24,7 +24,7 @@ export { default as NodeKeywords } from './core/NodeKeywords.js';
|
|
|
24
24
|
export { default as NodeUniform } from './core/NodeUniform.js';
|
|
25
25
|
export { default as NodeVar } from './core/NodeVar.js';
|
|
26
26
|
export { default as NodeVarying } from './core/NodeVarying.js';
|
|
27
|
-
export { default as PropertyNode, property, diffuseColor, roughness, metalness, specularColor, shininess } from './core/PropertyNode.js';
|
|
27
|
+
export { default as PropertyNode, property, output, diffuseColor, roughness, metalness, specularColor, shininess } from './core/PropertyNode.js';
|
|
28
28
|
export { default as StackNode, stack } from './core/StackNode.js';
|
|
29
29
|
export { default as TempNode } from './core/TempNode.js';
|
|
30
30
|
export { default as UniformNode, uniform } from './core/UniformNode.js';
|
|
@@ -82,7 +82,7 @@ export { default as PositionNode, positionGeometry, positionLocal, positionWorld
|
|
|
82
82
|
export { default as ReferenceNode, reference } from './accessors/ReferenceNode.js';
|
|
83
83
|
export { default as ReflectVectorNode, reflectVector } from './accessors/ReflectVectorNode.js';
|
|
84
84
|
export { default as SkinningNode, skinning } from './accessors/SkinningNode.js';
|
|
85
|
-
export { default as SceneNode, backgroundBlurriness } from './accessors/SceneNode.js';
|
|
85
|
+
export { default as SceneNode, backgroundBlurriness, backgroundIntensity } from './accessors/SceneNode.js';
|
|
86
86
|
export { default as StorageBufferNode, storage } from './accessors/StorageBufferNode.js';
|
|
87
87
|
export { default as TangentNode, tangentGeometry, tangentLocal, tangentView, tangentWorld, transformedTangentView, transformedTangentWorld } from './accessors/TangentNode.js';
|
|
88
88
|
export { default as TextureNode, texture, /*textureLevel,*/ sampler } from './accessors/TextureNode.js';
|
|
@@ -155,7 +155,6 @@ export * from './materials/Materials.js';
|
|
|
155
155
|
export * from './materialx/MaterialXNodes.js';
|
|
156
156
|
|
|
157
157
|
// functions
|
|
158
|
-
export { default as BRDF_BlinnPhong } from './functions/BSDF/BRDF_BlinnPhong.js';
|
|
159
158
|
export { default as BRDF_GGX } from './functions/BSDF/BRDF_GGX.js';
|
|
160
159
|
export { default as BRDF_Lambert } from './functions/BSDF/BRDF_Lambert.js';
|
|
161
160
|
export { default as D_GGX } from './functions/BSDF/D_GGX.js';
|
|
@@ -168,5 +167,5 @@ export { getDistanceAttenuation } from './lighting/LightUtils.js';
|
|
|
168
167
|
export { default as getGeometryRoughness } from './functions/material/getGeometryRoughness.js';
|
|
169
168
|
export { default as getRoughness } from './functions/material/getRoughness.js';
|
|
170
169
|
|
|
171
|
-
export { default as
|
|
172
|
-
export { default as
|
|
170
|
+
export { default as PhongLightingModel } from './functions/PhongLightingModel.js';
|
|
171
|
+
export { default as PhysicalLightingModel } from './functions/PhysicalLightingModel.js';
|
|
@@ -29,7 +29,7 @@ class BufferAttributeNode extends InputNode {
|
|
|
29
29
|
const stride = this.bufferStride || itemSize;
|
|
30
30
|
const offset = this.bufferOffset;
|
|
31
31
|
|
|
32
|
-
const buffer = new InterleavedBuffer( array, stride );
|
|
32
|
+
const buffer = array.isInterleavedBuffer === true ? array : new InterleavedBuffer( array, stride );
|
|
33
33
|
const bufferAttribute = new InterleavedBufferAttribute( buffer, itemSize, offset );
|
|
34
34
|
|
|
35
35
|
buffer.setUsage( this.usage );
|