super-three 0.170.0 → 0.171.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 +24410 -24422
- package/build/three.core.js +37002 -0
- package/build/three.core.min.js +6 -0
- package/build/three.module.js +10573 -47578
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +533 -0
- package/build/three.tsl.min.js +6 -0
- package/build/three.webgpu.js +2907 -37975
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +2914 -37959
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/capabilities/WebGPU.js +1 -10
- package/examples/jsm/controls/ArcballControls.js +25 -21
- package/examples/jsm/controls/OrbitControls.js +41 -9
- package/examples/jsm/controls/PointerLockControls.js +2 -5
- package/examples/jsm/csm/CSMShadowNode.js +7 -5
- package/examples/jsm/geometries/DecalGeometry.js +5 -1
- package/examples/jsm/lighting/TiledLighting.js +1 -1
- package/examples/jsm/lines/LineGeometry.js +25 -0
- package/examples/jsm/lines/LineMaterial.js +1 -7
- package/examples/jsm/lines/webgpu/Line2.js +2 -1
- package/examples/jsm/lines/webgpu/LineSegments2.js +2 -1
- package/examples/jsm/lines/webgpu/Wireframe.js +2 -1
- package/examples/jsm/loaders/KTX2Loader.js +3 -0
- package/examples/jsm/loaders/MMDLoader.js +2 -6
- package/examples/jsm/loaders/MaterialXLoader.js +2 -2
- package/examples/jsm/materials/MeshGouraudMaterial.js +2 -6
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +2 -2
- package/examples/jsm/objects/InstancedPoints.js +2 -4
- package/examples/jsm/objects/LensflareMesh.js +4 -2
- package/examples/jsm/objects/SkyMesh.js +5 -3
- package/examples/jsm/objects/Water2Mesh.js +7 -3
- package/examples/jsm/objects/WaterMesh.js +5 -3
- package/examples/jsm/transpiler/AST.js +2 -2
- package/examples/jsm/transpiler/GLSLDecoder.js +57 -25
- package/examples/jsm/transpiler/TSLEncoder.js +11 -6
- package/examples/jsm/tsl/display/AfterImageNode.js +3 -3
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +2 -2
- package/examples/jsm/tsl/display/AnamorphicNode.js +2 -2
- package/examples/jsm/tsl/display/BloomNode.js +3 -3
- package/examples/jsm/tsl/display/DenoiseNode.js +48 -12
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +3 -2
- package/examples/jsm/tsl/display/DotScreenNode.js +2 -2
- package/examples/jsm/tsl/display/FXAANode.js +3 -3
- package/examples/jsm/tsl/display/FilmNode.js +3 -2
- package/examples/jsm/tsl/display/GTAONode.js +62 -27
- package/examples/jsm/tsl/display/GaussianBlurNode.js +6 -8
- package/examples/jsm/tsl/display/LensflareNode.js +3 -3
- package/examples/jsm/tsl/display/Lut3DNode.js +3 -2
- package/examples/jsm/tsl/display/OutlineNode.js +2 -2
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +2 -1
- package/examples/jsm/tsl/display/PixelationPassNode.js +4 -4
- package/examples/jsm/tsl/display/RGBShiftNode.js +2 -1
- package/examples/jsm/tsl/display/SMAANode.js +3 -3
- package/examples/jsm/tsl/display/SSAAPassNode.js +2 -2
- package/examples/jsm/tsl/display/SSRNode.js +31 -8
- package/examples/jsm/tsl/display/SobelOperatorNode.js +3 -3
- package/examples/jsm/tsl/display/StereoCompositePassNode.js +4 -4
- package/examples/jsm/tsl/display/StereoPassNode.js +2 -2
- package/examples/jsm/tsl/display/TRAAPassNode.js +2 -2
- package/examples/jsm/tsl/display/TransitionNode.js +3 -2
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +6 -9
- package/examples/jsm/utils/SceneOptimizer.js +410 -0
- package/examples/jsm/utils/UVsDebug.js +1 -1
- package/package.json +3 -3
- package/src/Three.Core.js +178 -0
- package/src/Three.TSL.js +526 -0
- package/src/Three.WebGPU.Nodes.js +5 -186
- package/src/Three.WebGPU.js +4 -186
- package/src/Three.js +1 -177
- package/src/animation/AnimationClip.js +2 -2
- package/src/animation/AnimationObjectGroup.js +2 -2
- package/src/audio/Audio.js +38 -0
- package/src/cameras/PerspectiveCamera.js +6 -6
- package/src/cameras/StereoCamera.js +2 -2
- package/src/constants.js +1 -1
- package/src/core/BufferGeometry.js +5 -3
- package/src/core/InterleavedBuffer.js +4 -4
- package/src/core/Object3D.js +2 -2
- package/src/extras/core/Curve.js +3 -3
- package/src/extras/core/Shape.js +2 -2
- package/src/geometries/EdgesGeometry.js +2 -2
- package/src/geometries/LatheGeometry.js +2 -2
- package/src/lights/SpotLightShadow.js +2 -2
- package/src/materials/LineBasicMaterial.js +2 -6
- package/src/materials/LineDashedMaterial.js +1 -6
- package/src/materials/Material.js +3 -16
- package/src/materials/MeshBasicMaterial.js +2 -6
- package/src/materials/MeshDepthMaterial.js +2 -6
- package/src/materials/MeshDistanceMaterial.js +2 -6
- package/src/materials/MeshLambertMaterial.js +2 -6
- package/src/materials/MeshMatcapMaterial.js +2 -6
- package/src/materials/MeshNormalMaterial.js +2 -6
- package/src/materials/MeshPhongMaterial.js +3 -7
- package/src/materials/MeshPhysicalMaterial.js +4 -8
- package/src/materials/MeshStandardMaterial.js +2 -6
- package/src/materials/MeshToonMaterial.js +2 -6
- package/src/materials/PointsMaterial.js +2 -6
- package/src/materials/RawShaderMaterial.js +2 -6
- package/src/materials/ShaderMaterial.js +2 -6
- package/src/materials/ShadowMaterial.js +2 -6
- package/src/materials/SpriteMaterial.js +2 -6
- package/src/materials/nodes/Line2NodeMaterial.js +32 -13
- package/src/materials/nodes/LineDashedNodeMaterial.js +4 -2
- package/src/materials/nodes/NodeMaterial.js +64 -16
- package/src/materials/nodes/manager/NodeMaterialObserver.js +13 -10
- package/src/math/ColorManagement.js +130 -122
- package/src/math/Line3.js +2 -2
- package/src/math/Quaternion.js +2 -2
- package/src/math/Spherical.js +3 -3
- package/src/math/Vector2.js +7 -7
- package/src/math/Vector3.js +9 -9
- package/src/math/Vector4.js +11 -9
- package/src/nodes/Nodes.js +1 -0
- package/src/nodes/TSL.js +3 -1
- package/src/nodes/accessors/Arrays.js +27 -0
- package/src/nodes/accessors/BuiltinNode.js +26 -0
- package/src/nodes/accessors/ClippingNode.js +76 -42
- package/src/nodes/accessors/InstanceNode.js +17 -20
- package/src/nodes/accessors/InstancedMeshNode.js +26 -0
- package/src/nodes/accessors/Lights.js +32 -0
- package/src/nodes/accessors/StorageBufferNode.js +29 -9
- package/src/nodes/accessors/StorageTextureNode.js +10 -4
- package/src/nodes/accessors/TextureNode.js +1 -1
- package/src/nodes/core/NodeBuilder.js +2 -9
- package/src/nodes/core/NodeUtils.js +28 -0
- package/src/nodes/core/constants.js +6 -0
- package/src/nodes/display/BlendModes.js +99 -0
- package/src/nodes/display/ToonOutlinePassNode.js +3 -3
- package/src/nodes/display/ViewportDepthNode.js +21 -6
- package/src/nodes/functions/material/getAlphaHashThreshold.js +13 -7
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +1 -1
- package/src/nodes/lighting/AnalyticLightNode.js +12 -4
- package/src/nodes/lighting/PointLightNode.js +10 -1
- package/src/nodes/lighting/PointShadowNode.js +254 -0
- package/src/nodes/lighting/ShadowNode.js +176 -67
- package/src/nodes/lighting/SpotLightNode.js +14 -2
- package/src/nodes/utils/RTTNode.js +9 -1
- package/src/nodes/utils/StorageArrayElementNode.js +2 -2
- package/src/objects/BatchedMesh.js +54 -95
- package/src/objects/ClippingGroup.js +19 -0
- package/src/objects/Skeleton.js +2 -2
- package/src/renderers/WebGLRenderer.js +94 -23
- package/src/renderers/common/Animation.js +23 -11
- package/src/renderers/common/Background.js +1 -1
- package/src/renderers/common/Bindings.js +20 -4
- package/src/renderers/common/ClippingContext.js +77 -85
- package/src/renderers/common/RenderList.js +9 -6
- package/src/renderers/common/RenderObject.js +27 -27
- package/src/renderers/common/RenderObjects.js +12 -6
- package/src/renderers/common/Renderer.js +63 -57
- package/src/renderers/common/Textures.js +11 -3
- package/src/renderers/common/UniformsGroup.js +16 -4
- package/src/renderers/common/extras/PMREMGenerator.js +89 -13
- package/src/renderers/common/nodes/NodeLibrary.js +2 -2
- package/src/renderers/common/nodes/NodeStorageBuffer.js +2 -3
- package/src/renderers/common/nodes/NodeUniform.js +42 -0
- package/src/renderers/webgl/WebGLBackground.js +20 -1
- package/src/renderers/webgl/WebGLGeometries.js +0 -28
- package/src/renderers/webgl-fallback/WebGLBackend.js +13 -6
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +43 -12
- package/src/renderers/webgl-fallback/utils/WebGLState.js +26 -1
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +4 -1
- package/src/renderers/webgpu/WebGPUBackend.js +47 -31
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +13 -26
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +184 -74
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +15 -2
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +72 -7
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +5 -1
- package/src/textures/Source.js +2 -2
- package/src/textures/Texture.js +2 -2
- package/src/nodes/display/BlendMode.js +0 -54
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
self.GPUShaderStage = { VERTEX: 1, FRAGMENT: 2, COMPUTE: 4 };
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
// statics
|
|
8
|
-
|
|
9
|
-
let isAvailable = navigator.gpu !== undefined;
|
|
10
|
-
|
|
1
|
+
let isAvailable = ( typeof navigator !== 'undefined' && navigator.gpu !== undefined );
|
|
11
2
|
|
|
12
3
|
if ( typeof window !== 'undefined' && isAvailable ) {
|
|
13
4
|
|
|
@@ -204,6 +204,7 @@ class ArcballControls extends Controls {
|
|
|
204
204
|
this.enableRotate = true;
|
|
205
205
|
this.enableZoom = true;
|
|
206
206
|
this.enableGizmos = true;
|
|
207
|
+
this.enableFocus = true;
|
|
207
208
|
|
|
208
209
|
this.minDistance = 0;
|
|
209
210
|
this.maxDistance = Infinity;
|
|
@@ -697,7 +698,7 @@ class ArcballControls extends Controls {
|
|
|
697
698
|
|
|
698
699
|
onDoubleTap( event ) {
|
|
699
700
|
|
|
700
|
-
if ( this.enabled && this.enablePan && this.scene != null ) {
|
|
701
|
+
if ( this.enabled && this.enablePan && this.enableFocus && this.scene != null ) {
|
|
701
702
|
|
|
702
703
|
this.dispatchEvent( _startEvent );
|
|
703
704
|
|
|
@@ -2036,29 +2037,32 @@ class ArcballControls extends Controls {
|
|
|
2036
2037
|
let state;
|
|
2037
2038
|
if ( this.object.isOrthographicCamera ) {
|
|
2038
2039
|
|
|
2039
|
-
state = JSON.stringify( {
|
|
2040
|
+
state = JSON.stringify( {
|
|
2041
|
+
arcballState: {
|
|
2042
|
+
cameraFar: this.object.far,
|
|
2043
|
+
cameraMatrix: this.object.matrix,
|
|
2044
|
+
cameraNear: this.object.near,
|
|
2045
|
+
cameraUp: this.object.up,
|
|
2046
|
+
cameraZoom: this.object.zoom,
|
|
2047
|
+
gizmoMatrix: this._gizmos.matrix
|
|
2040
2048
|
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
cameraNear: this.object.near,
|
|
2044
|
-
cameraUp: this.object.up,
|
|
2045
|
-
cameraZoom: this.object.zoom,
|
|
2046
|
-
gizmoMatrix: this._gizmos.matrix
|
|
2047
|
-
|
|
2048
|
-
} } );
|
|
2049
|
+
}
|
|
2050
|
+
} );
|
|
2049
2051
|
|
|
2050
2052
|
} else if ( this.object.isPerspectiveCamera ) {
|
|
2051
2053
|
|
|
2052
|
-
state = JSON.stringify( {
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2054
|
+
state = JSON.stringify( {
|
|
2055
|
+
arcballState: {
|
|
2056
|
+
cameraFar: this.object.far,
|
|
2057
|
+
cameraFov: this.object.fov,
|
|
2058
|
+
cameraMatrix: this.object.matrix,
|
|
2059
|
+
cameraNear: this.object.near,
|
|
2060
|
+
cameraUp: this.object.up,
|
|
2061
|
+
cameraZoom: this.object.zoom,
|
|
2062
|
+
gizmoMatrix: this._gizmos.matrix
|
|
2060
2063
|
|
|
2061
|
-
|
|
2064
|
+
}
|
|
2065
|
+
} );
|
|
2062
2066
|
|
|
2063
2067
|
}
|
|
2064
2068
|
|
|
@@ -2233,7 +2237,7 @@ class ArcballControls extends Controls {
|
|
|
2233
2237
|
* @param {Matrix4} camera Transformation to be applied to the camera
|
|
2234
2238
|
* @param {Matrix4} gizmos Transformation to be applied to gizmos
|
|
2235
2239
|
*/
|
|
2236
|
-
|
|
2240
|
+
setTransformationMatrices( camera = null, gizmos = null ) {
|
|
2237
2241
|
|
|
2238
2242
|
if ( camera != null ) {
|
|
2239
2243
|
|
|
@@ -2620,7 +2624,7 @@ class ArcballControls extends Controls {
|
|
|
2620
2624
|
this.applyTransformMatrix( this.scale( newDistance / distance, this._gizmos.position ) );
|
|
2621
2625
|
this.updateMatrixState();
|
|
2622
2626
|
|
|
2623
|
-
|
|
2627
|
+
}
|
|
2624
2628
|
|
|
2625
2629
|
//check fov
|
|
2626
2630
|
if ( this.object.fov < this.minFov || this.object.fov > this.maxFov ) {
|
|
@@ -784,11 +784,19 @@ class OrbitControls extends Controls {
|
|
|
784
784
|
|
|
785
785
|
if ( event.ctrlKey || event.metaKey || event.shiftKey ) {
|
|
786
786
|
|
|
787
|
-
|
|
787
|
+
if ( this.enableRotate ) {
|
|
788
|
+
|
|
789
|
+
this._rotateUp( _twoPI * this.rotateSpeed / this.domElement.clientHeight );
|
|
790
|
+
|
|
791
|
+
}
|
|
788
792
|
|
|
789
793
|
} else {
|
|
790
794
|
|
|
791
|
-
|
|
795
|
+
if ( this.enablePan ) {
|
|
796
|
+
|
|
797
|
+
this._pan( 0, this.keyPanSpeed );
|
|
798
|
+
|
|
799
|
+
}
|
|
792
800
|
|
|
793
801
|
}
|
|
794
802
|
|
|
@@ -799,11 +807,19 @@ class OrbitControls extends Controls {
|
|
|
799
807
|
|
|
800
808
|
if ( event.ctrlKey || event.metaKey || event.shiftKey ) {
|
|
801
809
|
|
|
802
|
-
|
|
810
|
+
if ( this.enableRotate ) {
|
|
811
|
+
|
|
812
|
+
this._rotateUp( - _twoPI * this.rotateSpeed / this.domElement.clientHeight );
|
|
813
|
+
|
|
814
|
+
}
|
|
803
815
|
|
|
804
816
|
} else {
|
|
805
817
|
|
|
806
|
-
|
|
818
|
+
if ( this.enablePan ) {
|
|
819
|
+
|
|
820
|
+
this._pan( 0, - this.keyPanSpeed );
|
|
821
|
+
|
|
822
|
+
}
|
|
807
823
|
|
|
808
824
|
}
|
|
809
825
|
|
|
@@ -814,11 +830,19 @@ class OrbitControls extends Controls {
|
|
|
814
830
|
|
|
815
831
|
if ( event.ctrlKey || event.metaKey || event.shiftKey ) {
|
|
816
832
|
|
|
817
|
-
|
|
833
|
+
if ( this.enableRotate ) {
|
|
834
|
+
|
|
835
|
+
this._rotateLeft( _twoPI * this.rotateSpeed / this.domElement.clientHeight );
|
|
836
|
+
|
|
837
|
+
}
|
|
818
838
|
|
|
819
839
|
} else {
|
|
820
840
|
|
|
821
|
-
|
|
841
|
+
if ( this.enablePan ) {
|
|
842
|
+
|
|
843
|
+
this._pan( this.keyPanSpeed, 0 );
|
|
844
|
+
|
|
845
|
+
}
|
|
822
846
|
|
|
823
847
|
}
|
|
824
848
|
|
|
@@ -829,11 +853,19 @@ class OrbitControls extends Controls {
|
|
|
829
853
|
|
|
830
854
|
if ( event.ctrlKey || event.metaKey || event.shiftKey ) {
|
|
831
855
|
|
|
832
|
-
|
|
856
|
+
if ( this.enableRotate ) {
|
|
857
|
+
|
|
858
|
+
this._rotateLeft( - _twoPI * this.rotateSpeed / this.domElement.clientHeight );
|
|
859
|
+
|
|
860
|
+
}
|
|
833
861
|
|
|
834
862
|
} else {
|
|
835
863
|
|
|
836
|
-
|
|
864
|
+
if ( this.enablePan ) {
|
|
865
|
+
|
|
866
|
+
this._pan( - this.keyPanSpeed, 0 );
|
|
867
|
+
|
|
868
|
+
}
|
|
837
869
|
|
|
838
870
|
}
|
|
839
871
|
|
|
@@ -1340,7 +1372,7 @@ function onMouseWheel( event ) {
|
|
|
1340
1372
|
|
|
1341
1373
|
function onKeyDown( event ) {
|
|
1342
1374
|
|
|
1343
|
-
if ( this.enabled === false
|
|
1375
|
+
if ( this.enabled === false ) return;
|
|
1344
1376
|
|
|
1345
1377
|
this._handleKeyDown( event );
|
|
1346
1378
|
|
|
@@ -127,14 +127,11 @@ function onMouseMove( event ) {
|
|
|
127
127
|
|
|
128
128
|
if ( this.enabled === false || this.isLocked === false ) return;
|
|
129
129
|
|
|
130
|
-
const movementX = event.movementX || event.mozMovementX || event.webkitMovementX || 0;
|
|
131
|
-
const movementY = event.movementY || event.mozMovementY || event.webkitMovementY || 0;
|
|
132
|
-
|
|
133
130
|
const camera = this.object;
|
|
134
131
|
_euler.setFromQuaternion( camera.quaternion );
|
|
135
132
|
|
|
136
|
-
_euler.y -= movementX * 0.002 * this.pointerSpeed;
|
|
137
|
-
_euler.x -= movementY * 0.002 * this.pointerSpeed;
|
|
133
|
+
_euler.y -= event.movementX * 0.002 * this.pointerSpeed;
|
|
134
|
+
_euler.x -= event.movementY * 0.002 * this.pointerSpeed;
|
|
138
135
|
|
|
139
136
|
_euler.x = Math.max( _PI_2 - this.maxPolarAngle, Math.min( _PI_2 - this.minPolarAngle, _euler.x ) );
|
|
140
137
|
|
|
@@ -5,11 +5,13 @@ import {
|
|
|
5
5
|
Matrix4,
|
|
6
6
|
Box3,
|
|
7
7
|
Object3D,
|
|
8
|
-
WebGLCoordinateSystem
|
|
9
|
-
|
|
8
|
+
WebGLCoordinateSystem,
|
|
9
|
+
NodeUpdateType,
|
|
10
|
+
Node
|
|
11
|
+
} from 'three/webgpu';
|
|
10
12
|
|
|
11
13
|
import { CSMFrustum } from './CSMFrustum.js';
|
|
12
|
-
import { viewZToOrthographicDepth, reference, uniform, float, vec4, vec2, If, Fn, min, renderGroup, positionView,
|
|
14
|
+
import { viewZToOrthographicDepth, reference, uniform, float, vec4, vec2, If, Fn, min, renderGroup, positionView, shadow } from 'three/tsl';
|
|
13
15
|
|
|
14
16
|
const _cameraToLightMatrix = new Matrix4();
|
|
15
17
|
const _lightSpaceFrustum = new CSMFrustum();
|
|
@@ -253,7 +255,7 @@ class CSMShadowNode extends Node {
|
|
|
253
255
|
|
|
254
256
|
setupFade() {
|
|
255
257
|
|
|
256
|
-
const cameraNear = reference( 'camera.near', 'float', this ).setGroup( renderGroup )
|
|
258
|
+
const cameraNear = reference( 'camera.near', 'float', this ).setGroup( renderGroup );
|
|
257
259
|
const cascades = reference( '_cascades', 'vec2', this ).setGroup( renderGroup ).label( 'cacades' );
|
|
258
260
|
|
|
259
261
|
const shadowFar = uniform( 'float' ).setGroup( renderGroup ).label( 'shadowFar' )
|
|
@@ -327,7 +329,7 @@ class CSMShadowNode extends Node {
|
|
|
327
329
|
|
|
328
330
|
setupStandard() {
|
|
329
331
|
|
|
330
|
-
const cameraNear = reference( 'camera.near', 'float', this ).setGroup( renderGroup )
|
|
332
|
+
const cameraNear = reference( 'camera.near', 'float', this ).setGroup( renderGroup );
|
|
331
333
|
const cascades = reference( '_cascades', 'vec2', this ).setGroup( renderGroup ).label( 'cacades' );
|
|
332
334
|
|
|
333
335
|
const shadowFar = uniform( 'float' ).setGroup( renderGroup ).label( 'shadowFar' )
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BufferGeometry,
|
|
3
|
+
Euler,
|
|
3
4
|
Float32BufferAttribute,
|
|
4
5
|
Matrix3,
|
|
5
6
|
Matrix4,
|
|
7
|
+
Mesh,
|
|
6
8
|
Vector3
|
|
7
9
|
} from 'three';
|
|
8
10
|
|
|
@@ -23,7 +25,7 @@ import {
|
|
|
23
25
|
|
|
24
26
|
class DecalGeometry extends BufferGeometry {
|
|
25
27
|
|
|
26
|
-
constructor( mesh, position, orientation, size ) {
|
|
28
|
+
constructor( mesh = new Mesh(), position = new Vector3(), orientation = new Euler(), size = new Vector3( 1, 1, 1 ) ) {
|
|
27
29
|
|
|
28
30
|
super();
|
|
29
31
|
|
|
@@ -109,6 +111,8 @@ class DecalGeometry extends BufferGeometry {
|
|
|
109
111
|
|
|
110
112
|
} else {
|
|
111
113
|
|
|
114
|
+
if ( positionAttribute === undefined ) return; // empty geometry
|
|
115
|
+
|
|
112
116
|
// non-indexed BufferGeometry
|
|
113
117
|
|
|
114
118
|
for ( let i = 0; i < positionAttribute.count; i ++ ) {
|
|
@@ -62,6 +62,31 @@ class LineGeometry extends LineSegmentsGeometry {
|
|
|
62
62
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
setFromPoints( points ) {
|
|
66
|
+
|
|
67
|
+
// converts a vector3 or vector2 array to pairs format
|
|
68
|
+
|
|
69
|
+
const length = points.length - 1;
|
|
70
|
+
const positions = new Float32Array( 6 * length );
|
|
71
|
+
|
|
72
|
+
for ( let i = 0; i < length; i ++ ) {
|
|
73
|
+
|
|
74
|
+
positions[ 6 * i ] = points[ i ].x;
|
|
75
|
+
positions[ 6 * i + 1 ] = points[ i ].y;
|
|
76
|
+
positions[ 6 * i + 2 ] = points[ i ].z || 0;
|
|
77
|
+
|
|
78
|
+
positions[ 6 * i + 3 ] = points[ i + 1 ].x;
|
|
79
|
+
positions[ 6 * i + 4 ] = points[ i + 1 ].y;
|
|
80
|
+
positions[ 6 * i + 5 ] = points[ i + 1 ].z || 0;
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
super.setPositions( positions );
|
|
85
|
+
|
|
86
|
+
return this;
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
|
|
65
90
|
fromLine( line ) {
|
|
66
91
|
|
|
67
92
|
const geometry = line.geometry;
|
|
@@ -405,17 +405,11 @@ ShaderLib[ 'line' ] = {
|
|
|
405
405
|
|
|
406
406
|
class LineMaterial extends ShaderMaterial {
|
|
407
407
|
|
|
408
|
-
|
|
409
|
-
static get type() {
|
|
410
|
-
|
|
411
|
-
return 'LineMaterial';
|
|
412
|
-
|
|
413
|
-
}
|
|
414
|
-
|
|
415
408
|
constructor( parameters ) {
|
|
416
409
|
|
|
417
410
|
super( {
|
|
418
411
|
|
|
412
|
+
type: 'LineMaterial',
|
|
419
413
|
uniforms: UniformsUtils.clone( ShaderLib[ 'line' ].uniforms ),
|
|
420
414
|
|
|
421
415
|
vertexShader: ShaderLib[ 'line' ].vertexShader,
|
|
@@ -988,6 +988,9 @@ async function createRawTexture( container ) {
|
|
|
988
988
|
|
|
989
989
|
texture = new CompressedTexture( mipmaps, container.pixelWidth, container.pixelHeight );
|
|
990
990
|
|
|
991
|
+
texture.minFilter = mipmaps.length === 1 ? LinearFilter : LinearMipmapLinearFilter;
|
|
992
|
+
texture.magFilter = LinearFilter;
|
|
993
|
+
|
|
991
994
|
}
|
|
992
995
|
|
|
993
996
|
texture.mipmaps = mipmaps;
|
|
@@ -2131,18 +2131,14 @@ class CubicBezierInterpolation extends Interpolant {
|
|
|
2131
2131
|
|
|
2132
2132
|
class MMDToonMaterial extends ShaderMaterial {
|
|
2133
2133
|
|
|
2134
|
-
static get type() {
|
|
2135
|
-
|
|
2136
|
-
return 'MMDToonMaterial';
|
|
2137
|
-
|
|
2138
|
-
}
|
|
2139
|
-
|
|
2140
2134
|
constructor( parameters ) {
|
|
2141
2135
|
|
|
2142
2136
|
super();
|
|
2143
2137
|
|
|
2144
2138
|
this.isMMDToonMaterial = true;
|
|
2145
2139
|
|
|
2140
|
+
this.type = 'MMDToonMaterial';
|
|
2141
|
+
|
|
2146
2142
|
this._matcapCombine = AddOperation;
|
|
2147
2143
|
this.emissiveIntensity = 1.0;
|
|
2148
2144
|
this.normalMapType = TangentSpaceNormalMap;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FileLoader, Loader, TextureLoader, MeshBasicNodeMaterial, MeshPhysicalNodeMaterial
|
|
1
|
+
import { FileLoader, Loader, TextureLoader, RepeatWrapping, MeshBasicNodeMaterial, MeshPhysicalNodeMaterial } from 'three/webgpu';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
float, bool, int, vec2, vec3, vec4, color, texture,
|
|
@@ -396,7 +396,7 @@ class MaterialXNode {
|
|
|
396
396
|
|
|
397
397
|
} else if ( this.hasReference ) {
|
|
398
398
|
|
|
399
|
-
if ( this.element === 'output' && this.output && out === null
|
|
399
|
+
if ( this.element === 'output' && this.output && out === null ) {
|
|
400
400
|
|
|
401
401
|
out = this.output;
|
|
402
402
|
|
|
@@ -315,18 +315,14 @@ const GouraudShader = {
|
|
|
315
315
|
|
|
316
316
|
class MeshGouraudMaterial extends ShaderMaterial {
|
|
317
317
|
|
|
318
|
-
static get type() {
|
|
319
|
-
|
|
320
|
-
return 'MeshGouraudMaterial';
|
|
321
|
-
|
|
322
|
-
}
|
|
323
|
-
|
|
324
318
|
constructor( parameters ) {
|
|
325
319
|
|
|
326
320
|
super();
|
|
327
321
|
|
|
328
322
|
this.isMeshGouraudMaterial = true;
|
|
329
323
|
|
|
324
|
+
this.type = 'MeshGouraudMaterial';
|
|
325
|
+
|
|
330
326
|
//this.color = new THREE.Color( 0xffffff ); // diffuse
|
|
331
327
|
|
|
332
328
|
//this.map = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DoubleSide, FloatType, HalfFloatType, PlaneGeometry, Mesh, RenderTarget, Scene } from 'three';
|
|
2
|
-
import { add, float, mix,
|
|
1
|
+
import { DoubleSide, FloatType, HalfFloatType, PlaneGeometry, Mesh, RenderTarget, Scene, MeshPhongNodeMaterial, NodeMaterial } from 'three/webgpu';
|
|
2
|
+
import { add, float, mix, output, sub, texture, uniform, uv, vec2, vec4 } from 'three/tsl';
|
|
3
3
|
|
|
4
4
|
import { potpack } from '../libs/potpack.module.js';
|
|
5
5
|
|
|
@@ -12,9 +12,11 @@ import {
|
|
|
12
12
|
UnsignedByteType,
|
|
13
13
|
Vector2,
|
|
14
14
|
Vector3,
|
|
15
|
-
Vector4
|
|
15
|
+
Vector4,
|
|
16
|
+
Node
|
|
17
|
+
} from 'three/webgpu';
|
|
16
18
|
|
|
17
|
-
import { texture, textureLoad, uv, ivec2, vec2, vec4, positionGeometry, reference, varyingProperty, materialReference, Fn
|
|
19
|
+
import { texture, textureLoad, uv, ivec2, vec2, vec4, positionGeometry, reference, varyingProperty, materialReference, Fn } from 'three/tsl';
|
|
18
20
|
|
|
19
21
|
class LensflareMesh extends Mesh {
|
|
20
22
|
|
|
@@ -2,9 +2,11 @@ import {
|
|
|
2
2
|
BackSide,
|
|
3
3
|
BoxGeometry,
|
|
4
4
|
Mesh,
|
|
5
|
-
Vector3
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Vector3,
|
|
6
|
+
NodeMaterial
|
|
7
|
+
} from 'three/webgpu';
|
|
8
|
+
|
|
9
|
+
import { Fn, float, vec3, acos, add, mul, clamp, cos, dot, exp, max, mix, modelViewProjection, normalize, positionWorld, pow, smoothstep, sub, varying, varyingProperty, vec4, uniform, cameraPosition } from 'three/tsl';
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* Based on "A Practical Analytic Model for Daylight"
|
|
@@ -2,9 +2,13 @@ import {
|
|
|
2
2
|
Color,
|
|
3
3
|
Mesh,
|
|
4
4
|
Vector2,
|
|
5
|
-
Vector3
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Vector3,
|
|
6
|
+
NodeMaterial,
|
|
7
|
+
NodeUpdateType,
|
|
8
|
+
TempNode
|
|
9
|
+
} from 'three/webgpu';
|
|
10
|
+
|
|
11
|
+
import { Fn, vec2, viewportSafeUV, viewportSharedTexture, reflector, pow, float, abs, texture, uniform, vec4, cameraPosition, positionWorld, uv, mix, vec3, normalize, max, dot, screenUV } from 'three/tsl';
|
|
8
12
|
|
|
9
13
|
/**
|
|
10
14
|
* References:
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Color,
|
|
3
3
|
Mesh,
|
|
4
|
-
Vector3
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
Vector3,
|
|
5
|
+
NodeMaterial
|
|
6
|
+
} from 'three/webgpu';
|
|
7
|
+
|
|
8
|
+
import { Fn, add, cameraPosition, div, normalize, positionWorld, sub, time, texture, vec2, vec3, vec4, max, dot, reflect, pow, length, float, uniform, reflector, mul, mix } from 'three/tsl';
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* Work based on :
|
|
@@ -242,9 +242,9 @@ export class DynamicElement {
|
|
|
242
242
|
|
|
243
243
|
export class AccessorElements {
|
|
244
244
|
|
|
245
|
-
constructor(
|
|
245
|
+
constructor( object, elements = [] ) {
|
|
246
246
|
|
|
247
|
-
this.
|
|
247
|
+
this.object = object;
|
|
248
248
|
this.elements = elements;
|
|
249
249
|
|
|
250
250
|
this.isAccessorElements = true;
|