super-three 0.160.0 → 0.161.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 +380 -109
- package/build/three.module.js +381 -109
- package/build/three.module.min.js +1 -1
- package/examples/jsm/Addons.js +5 -1
- package/examples/jsm/capabilities/WebGPU.js +13 -9
- package/examples/jsm/controls/OrbitControls.js +102 -13
- package/examples/jsm/curves/NURBSUtils.js +59 -4
- package/examples/jsm/curves/NURBSVolume.js +62 -0
- package/examples/jsm/exporters/USDZExporter.js +8 -7
- package/examples/jsm/helpers/TextureHelper.js +3 -3
- package/examples/jsm/loaders/3DMLoader.js +44 -43
- package/examples/jsm/loaders/DDSLoader.js +1 -0
- package/examples/jsm/loaders/KTX2Loader.js +20 -5
- package/examples/jsm/loaders/LUT3dlLoader.js +78 -46
- package/examples/jsm/loaders/LUTCubeLoader.js +81 -67
- package/examples/jsm/loaders/LUTImageLoader.js +3 -2
- package/examples/jsm/loaders/MaterialXLoader.js +115 -16
- package/examples/jsm/loaders/SVGLoader.js +4 -3
- package/examples/jsm/loaders/VRMLLoader.js +1 -1
- package/examples/jsm/materials/MeshPostProcessingMaterial.js +144 -0
- package/examples/jsm/misc/Timer.js +13 -4
- package/examples/jsm/nodes/Nodes.js +16 -5
- package/examples/jsm/nodes/accessors/BufferAttributeNode.js +5 -3
- package/examples/jsm/nodes/accessors/CameraNode.js +9 -4
- package/examples/jsm/nodes/accessors/CubeTextureNode.js +12 -1
- package/examples/jsm/nodes/accessors/StorageBufferNode.js +27 -0
- package/examples/jsm/nodes/accessors/TextureStoreNode.js +56 -3
- package/examples/jsm/nodes/accessors/VertexColorNode.js +70 -0
- package/examples/jsm/nodes/core/AttributeNode.js +1 -1
- package/examples/jsm/nodes/core/NodeBuilder.js +23 -18
- package/examples/jsm/nodes/core/NodeFrame.js +16 -8
- package/examples/jsm/nodes/core/constants.js +1 -0
- package/examples/jsm/nodes/display/AfterImageNode.js +148 -0
- package/examples/jsm/nodes/display/AnamorphicNode.js +148 -0
- package/examples/jsm/nodes/display/ColorAdjustmentNode.js +3 -0
- package/examples/jsm/nodes/display/GaussianBlurNode.js +33 -13
- package/examples/jsm/nodes/display/PassNode.js +3 -2
- package/examples/jsm/nodes/display/ToneMappingNode.js +46 -3
- package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +1 -4
- package/examples/jsm/nodes/display/ViewportNode.js +0 -2
- package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +4 -4
- package/examples/jsm/nodes/fog/FogNode.js +2 -1
- package/examples/jsm/nodes/lighting/AmbientLightNode.js +1 -1
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +13 -5
- package/examples/jsm/nodes/lighting/LightingContextNode.js +1 -1
- package/examples/jsm/nodes/lighting/LightsNode.js +1 -1
- package/examples/jsm/nodes/materials/Line2NodeMaterial.js +18 -30
- package/examples/jsm/nodes/materials/Materials.js +1 -0
- package/examples/jsm/nodes/materials/MeshSSSNodeMaterial.js +84 -0
- package/examples/jsm/nodes/materials/NodeMaterial.js +6 -4
- package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +1 -7
- package/examples/jsm/nodes/math/MathNode.js +12 -2
- package/examples/jsm/nodes/math/MathUtils.js +15 -0
- package/examples/jsm/nodes/math/OperatorNode.js +13 -5
- package/examples/jsm/nodes/math/TriNoise3D.js +71 -0
- package/examples/jsm/nodes/shadernode/ShaderNode.js +10 -1
- package/examples/jsm/nodes/utils/ArrayElementNode.js +6 -0
- package/examples/jsm/nodes/utils/JoinNode.js +2 -2
- package/examples/jsm/nodes/utils/LoopNode.js +3 -3
- package/examples/jsm/nodes/utils/ReflectorNode.js +227 -0
- package/examples/jsm/nodes/utils/RotateNode.js +68 -0
- package/examples/jsm/nodes/utils/RotateUVNode.js +1 -9
- package/examples/jsm/nodes/utils/SplitNode.js +4 -4
- package/examples/jsm/objects/GroundedSkybox.js +50 -0
- package/examples/jsm/objects/QuadMesh.js +8 -2
- package/examples/jsm/objects/Water2.js +8 -8
- package/examples/jsm/postprocessing/GTAOPass.js +11 -1
- package/examples/jsm/renderers/common/Backend.js +14 -0
- package/examples/jsm/renderers/common/Bindings.js +1 -1
- package/examples/jsm/renderers/common/DataMap.js +1 -1
- package/examples/jsm/renderers/common/Info.js +25 -1
- package/examples/jsm/renderers/common/Pipelines.js +8 -8
- package/examples/jsm/renderers/common/PostProcessing.js +2 -2
- package/examples/jsm/renderers/common/ProgrammableStage.js +3 -1
- package/examples/jsm/renderers/common/RenderObject.js +2 -0
- package/examples/jsm/renderers/common/Renderer.js +238 -22
- package/examples/jsm/renderers/common/StorageBufferAttribute.js +17 -0
- package/examples/jsm/renderers/common/Textures.js +25 -5
- package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +2 -1
- package/examples/jsm/renderers/common/nodes/Nodes.js +4 -2
- package/examples/jsm/renderers/webgl/WebGLBackend.js +631 -270
- package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +37 -30
- package/examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js +89 -8
- package/examples/jsm/renderers/webgl/utils/WebGLConstants.js +11 -0
- package/examples/jsm/renderers/webgl/utils/WebGLState.js +197 -0
- package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +377 -11
- package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +2 -2
- package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +1 -21
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +2 -2
- package/examples/jsm/renderers/webgpu/WebGPUBackend.js +289 -102
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +7 -2
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +56 -39
- package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +9 -1
- package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +38 -4
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +85 -12
- package/examples/jsm/transpiler/AST.js +1 -1
- package/examples/jsm/transpiler/GLSLDecoder.js +1 -1
- package/examples/jsm/transpiler/ShaderToyDecoder.js +1 -1
- package/examples/jsm/transpiler/TSLEncoder.js +1 -1
- package/examples/jsm/utils/BufferGeometryUtils.js +23 -27
- package/examples/jsm/utils/SortUtils.js +2 -0
- package/examples/jsm/webxr/ARButton.js +12 -2
- package/examples/jsm/webxr/VRButton.js +12 -2
- package/examples/jsm/webxr/XRButton.js +12 -2
- package/examples/jsm/webxr/XRControllerModelFactory.js +6 -1
- package/examples/jsm/webxr/XRHandMeshModel.js +3 -1
- package/package.json +2 -2
- package/src/audio/Audio.js +1 -3
- package/src/cameras/PerspectiveCamera.js +35 -0
- package/src/constants.js +1 -2
- package/src/core/BufferAttribute.js +2 -1
- package/src/core/InterleavedBuffer.js +2 -1
- package/src/core/InterleavedBufferAttribute.js +20 -0
- package/src/materials/ShaderMaterial.js +2 -1
- package/src/math/Triangle.js +0 -30
- package/src/objects/BatchedMesh.js +6 -7
- package/src/objects/SkinnedMesh.js +0 -8
- package/src/renderers/WebGLRenderer.js +6 -2
- package/src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl.js +56 -11
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +15 -7
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +1 -2
- package/src/renderers/shaders/ShaderLib/distanceRGBA.glsl.js +1 -2
- package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +1 -2
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +1 -2
- package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +3 -1
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/points.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/sprite.glsl.js +1 -1
- package/src/renderers/webgl/WebGLAttributes.js +2 -2
- package/src/renderers/webgl/WebGLCubeMaps.js +1 -1
- package/src/renderers/webgl/WebGLProgram.js +30 -3
- package/src/renderers/webgl/WebGLPrograms.js +19 -11
- package/src/renderers/webgl/WebGLTextures.js +90 -16
- package/src/renderers/webxr/WebXRDepthSensing.js +105 -0
- package/src/renderers/webxr/WebXRManager.js +46 -0
- package/src/textures/Source.js +1 -0
- package/build/three.js +0 -54519
- package/build/three.min.js +0 -7
- package/examples/jsm/objects/GroundProjectedSkybox.js +0 -172
package/src/audio/Audio.js
CHANGED
|
@@ -270,9 +270,7 @@ class Audio extends Object3D {
|
|
|
270
270
|
|
|
271
271
|
this.detune = value;
|
|
272
272
|
|
|
273
|
-
if ( this.source.detune
|
|
274
|
-
|
|
275
|
-
if ( this.isPlaying === true ) {
|
|
273
|
+
if ( this.isPlaying === true && this.source.detune !== undefined ) {
|
|
276
274
|
|
|
277
275
|
this.source.detune.setTargetAtTime( this.detune, this.context.currentTime, 0.01 );
|
|
278
276
|
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { Camera } from './Camera.js';
|
|
2
2
|
import * as MathUtils from '../math/MathUtils.js';
|
|
3
|
+
import { Vector2 } from '../math/Vector2.js';
|
|
4
|
+
import { Vector3 } from '../math/Vector3.js';
|
|
5
|
+
|
|
6
|
+
const _v3 = /*@__PURE__*/ new Vector3();
|
|
7
|
+
const _minTarget = /*@__PURE__*/ new Vector2();
|
|
8
|
+
const _maxTarget = /*@__PURE__*/ new Vector2();
|
|
9
|
+
|
|
3
10
|
|
|
4
11
|
class PerspectiveCamera extends Camera {
|
|
5
12
|
|
|
@@ -99,6 +106,34 @@ class PerspectiveCamera extends Camera {
|
|
|
99
106
|
|
|
100
107
|
}
|
|
101
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Computes the 2D bounds of the camera's viewable rectangle at a given distance along the viewing direction.
|
|
111
|
+
* Sets minTarget and maxTarget to the coordinates of the lower-left and upper-right corners of the view rectangle.
|
|
112
|
+
*/
|
|
113
|
+
getViewBounds( distance, minTarget, maxTarget ) {
|
|
114
|
+
|
|
115
|
+
_v3.set( - 1, - 1, 0.5 ).applyMatrix4( this.projectionMatrixInverse );
|
|
116
|
+
|
|
117
|
+
minTarget.set( _v3.x, _v3.y ).multiplyScalar( - distance / _v3.z );
|
|
118
|
+
|
|
119
|
+
_v3.set( 1, 1, 0.5 ).applyMatrix4( this.projectionMatrixInverse );
|
|
120
|
+
|
|
121
|
+
maxTarget.set( _v3.x, _v3.y ).multiplyScalar( - distance / _v3.z );
|
|
122
|
+
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Computes the width and height of the camera's viewable rectangle at a given distance along the viewing direction.
|
|
127
|
+
* Copies the result into the target Vector2, where x is width and y is height.
|
|
128
|
+
*/
|
|
129
|
+
getViewSize( distance, target ) {
|
|
130
|
+
|
|
131
|
+
this.getViewBounds( distance, _minTarget, _maxTarget );
|
|
132
|
+
|
|
133
|
+
return target.subVectors( _maxTarget, _minTarget );
|
|
134
|
+
|
|
135
|
+
}
|
|
136
|
+
|
|
102
137
|
/**
|
|
103
138
|
* Sets an offset in a larger frustum. This is useful for multi-window or
|
|
104
139
|
* multi-monitor/multi-machine setups.
|
package/src/constants.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const REVISION = '
|
|
1
|
+
export const REVISION = '161';
|
|
2
2
|
|
|
3
3
|
export const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
4
4
|
export const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
@@ -13,7 +13,6 @@ export const VSMShadowMap = 3;
|
|
|
13
13
|
export const FrontSide = 0;
|
|
14
14
|
export const BackSide = 1;
|
|
15
15
|
export const DoubleSide = 2;
|
|
16
|
-
export const TwoPassDoubleSide = 2; // r149
|
|
17
16
|
export const NoBlending = 0;
|
|
18
17
|
export const NormalBlending = 1;
|
|
19
18
|
export const AdditiveBlending = 2;
|
|
@@ -3,6 +3,7 @@ import { Vector2 } from '../math/Vector2.js';
|
|
|
3
3
|
import { denormalize, normalize } from '../math/MathUtils.js';
|
|
4
4
|
import { StaticDrawUsage, FloatType } from '../constants.js';
|
|
5
5
|
import { fromHalfFloat, toHalfFloat } from '../extras/DataUtils.js';
|
|
6
|
+
import { warnOnce } from '../utils.js';
|
|
6
7
|
|
|
7
8
|
const _vector = /*@__PURE__*/ new Vector3();
|
|
8
9
|
const _vector2 = /*@__PURE__*/ new Vector2();
|
|
@@ -45,7 +46,7 @@ class BufferAttribute {
|
|
|
45
46
|
|
|
46
47
|
get updateRange() {
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
warnOnce( 'THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159
|
|
49
50
|
return this._updateRange;
|
|
50
51
|
|
|
51
52
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as MathUtils from '../math/MathUtils.js';
|
|
2
2
|
import { StaticDrawUsage } from '../constants.js';
|
|
3
|
+
import { warnOnce } from '../utils.js';
|
|
3
4
|
|
|
4
5
|
class InterleavedBuffer {
|
|
5
6
|
|
|
@@ -31,7 +32,7 @@ class InterleavedBuffer {
|
|
|
31
32
|
|
|
32
33
|
get updateRange() {
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
warnOnce( 'THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159
|
|
35
36
|
return this._updateRange;
|
|
36
37
|
|
|
37
38
|
}
|
|
@@ -86,6 +86,26 @@ class InterleavedBufferAttribute {
|
|
|
86
86
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
getComponent( index, component ) {
|
|
90
|
+
|
|
91
|
+
let value = this.array[ index * this.data.stride + this.offset + component ];
|
|
92
|
+
|
|
93
|
+
if ( this.normalized ) value = denormalize( value, this.array );
|
|
94
|
+
|
|
95
|
+
return value;
|
|
96
|
+
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
setComponent( index, component, value ) {
|
|
100
|
+
|
|
101
|
+
if ( this.normalized ) value = normalize( value, this.array );
|
|
102
|
+
|
|
103
|
+
this.data.array[ index * this.data.stride + this.offset + component ] = value;
|
|
104
|
+
|
|
105
|
+
return this;
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
|
|
89
109
|
setX( index, x ) {
|
|
90
110
|
|
|
91
111
|
if ( this.normalized ) x = normalize( x, this.array );
|
|
@@ -37,7 +37,8 @@ class ShaderMaterial extends Material {
|
|
|
37
37
|
fragDepth: false, // set to use fragment depth values
|
|
38
38
|
drawBuffers: false, // set to use draw buffers
|
|
39
39
|
shaderTextureLOD: false, // set to use shader texture LOD
|
|
40
|
-
clipCullDistance: false // set to use vertex shader clipping
|
|
40
|
+
clipCullDistance: false, // set to use vertex shader clipping
|
|
41
|
+
multiDraw: false // set to use vertex shader multi_draw / enable gl_DrawID
|
|
41
42
|
};
|
|
42
43
|
|
|
43
44
|
// When rendered geometry doesn't include these attributes but the material does,
|
package/src/math/Triangle.js
CHANGED
|
@@ -12,8 +12,6 @@ const _vap = /*@__PURE__*/ new Vector3();
|
|
|
12
12
|
const _vbp = /*@__PURE__*/ new Vector3();
|
|
13
13
|
const _vcp = /*@__PURE__*/ new Vector3();
|
|
14
14
|
|
|
15
|
-
let warnedGetUV = false;
|
|
16
|
-
|
|
17
15
|
class Triangle {
|
|
18
16
|
|
|
19
17
|
constructor( a = new Vector3(), b = new Vector3(), c = new Vector3() ) {
|
|
@@ -87,20 +85,6 @@ class Triangle {
|
|
|
87
85
|
|
|
88
86
|
}
|
|
89
87
|
|
|
90
|
-
static getUV( point, p1, p2, p3, uv1, uv2, uv3, target ) { // @deprecated, r151
|
|
91
|
-
|
|
92
|
-
if ( warnedGetUV === false ) {
|
|
93
|
-
|
|
94
|
-
console.warn( 'THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().' );
|
|
95
|
-
|
|
96
|
-
warnedGetUV = true;
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return this.getInterpolation( point, p1, p2, p3, uv1, uv2, uv3, target );
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
|
|
104
88
|
static getInterpolation( point, p1, p2, p3, v1, v2, v3, target ) {
|
|
105
89
|
|
|
106
90
|
if ( this.getBarycoord( point, p1, p2, p3, _v3 ) === null ) {
|
|
@@ -211,20 +195,6 @@ class Triangle {
|
|
|
211
195
|
|
|
212
196
|
}
|
|
213
197
|
|
|
214
|
-
getUV( point, uv1, uv2, uv3, target ) { // @deprecated, r151
|
|
215
|
-
|
|
216
|
-
if ( warnedGetUV === false ) {
|
|
217
|
-
|
|
218
|
-
console.warn( 'THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().' );
|
|
219
|
-
|
|
220
|
-
warnedGetUV = true;
|
|
221
|
-
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
return Triangle.getInterpolation( point, this.a, this.b, this.c, uv1, uv2, uv3, target );
|
|
225
|
-
|
|
226
|
-
}
|
|
227
|
-
|
|
228
198
|
getInterpolation( point, v1, v2, v3, target ) {
|
|
229
199
|
|
|
230
200
|
return Triangle.getInterpolation( point, this.a, this.b, this.c, v1, v2, v3, target );
|
|
@@ -8,8 +8,6 @@ import { RGBAFormat } from '../constants.js';
|
|
|
8
8
|
import { Box3 } from '../math/Box3.js';
|
|
9
9
|
import { Sphere } from '../math/Sphere.js';
|
|
10
10
|
import { Frustum } from '../math/Frustum.js';
|
|
11
|
-
import { WebGLCoordinateSystem } from '../constants.js';
|
|
12
|
-
import { WebGPUCoordinateSystem } from '../constants.js';
|
|
13
11
|
import { Vector3 } from '../math/Vector3.js';
|
|
14
12
|
|
|
15
13
|
function sortOpaque( a, b ) {
|
|
@@ -600,7 +598,7 @@ class BatchedMesh extends Mesh {
|
|
|
600
598
|
const active = this._active;
|
|
601
599
|
if ( active[ id ] === false ) {
|
|
602
600
|
|
|
603
|
-
return
|
|
601
|
+
return null;
|
|
604
602
|
|
|
605
603
|
}
|
|
606
604
|
|
|
@@ -643,7 +641,7 @@ class BatchedMesh extends Mesh {
|
|
|
643
641
|
const active = this._active;
|
|
644
642
|
if ( active[ id ] === false ) {
|
|
645
643
|
|
|
646
|
-
return
|
|
644
|
+
return null;
|
|
647
645
|
|
|
648
646
|
}
|
|
649
647
|
|
|
@@ -894,6 +892,7 @@ class BatchedMesh extends Mesh {
|
|
|
894
892
|
const index = geometry.getIndex();
|
|
895
893
|
const bytesPerElement = index === null ? 1 : index.array.BYTES_PER_ELEMENT;
|
|
896
894
|
|
|
895
|
+
const active = this._active;
|
|
897
896
|
const visibility = this._visibility;
|
|
898
897
|
const multiDrawStarts = this._multiDrawStarts;
|
|
899
898
|
const multiDrawCounts = this._multiDrawCounts;
|
|
@@ -908,7 +907,7 @@ class BatchedMesh extends Mesh {
|
|
|
908
907
|
.multiply( this.matrixWorld );
|
|
909
908
|
_frustum.setFromProjectionMatrix(
|
|
910
909
|
_projScreenMatrix,
|
|
911
|
-
renderer.
|
|
910
|
+
renderer.coordinateSystem
|
|
912
911
|
);
|
|
913
912
|
|
|
914
913
|
}
|
|
@@ -922,7 +921,7 @@ class BatchedMesh extends Mesh {
|
|
|
922
921
|
|
|
923
922
|
for ( let i = 0, l = visibility.length; i < l; i ++ ) {
|
|
924
923
|
|
|
925
|
-
if ( visibility[ i ] ) {
|
|
924
|
+
if ( visibility[ i ] && active[ i ] ) {
|
|
926
925
|
|
|
927
926
|
// get the bounds in world space
|
|
928
927
|
this.getMatrixAt( i, _matrix );
|
|
@@ -976,7 +975,7 @@ class BatchedMesh extends Mesh {
|
|
|
976
975
|
|
|
977
976
|
for ( let i = 0, l = visibility.length; i < l; i ++ ) {
|
|
978
977
|
|
|
979
|
-
if ( visibility[ i ] ) {
|
|
978
|
+
if ( visibility[ i ] && active[ i ] ) {
|
|
980
979
|
|
|
981
980
|
// determine whether the batched geometry is within the frustum
|
|
982
981
|
let culled = false;
|
|
@@ -252,14 +252,6 @@ class SkinnedMesh extends Mesh {
|
|
|
252
252
|
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
-
boneTransform( index, vector ) { // @deprecated, r151
|
|
256
|
-
|
|
257
|
-
console.warn( 'THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151.' );
|
|
258
|
-
return this.applyBoneTransform( index, vector );
|
|
259
|
-
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
|
|
263
255
|
}
|
|
264
256
|
|
|
265
257
|
export { SkinnedMesh };
|
|
@@ -1214,7 +1214,11 @@ class WebGLRenderer {
|
|
|
1214
1214
|
|
|
1215
1215
|
//
|
|
1216
1216
|
|
|
1217
|
-
|
|
1217
|
+
if ( xr.enabled === false || xr.isPresenting === false || xr.hasDepthSensing() === false ) {
|
|
1218
|
+
|
|
1219
|
+
background.render( currentRenderList, scene );
|
|
1220
|
+
|
|
1221
|
+
}
|
|
1218
1222
|
|
|
1219
1223
|
// render scene
|
|
1220
1224
|
|
|
@@ -2235,7 +2239,7 @@ class WebGLRenderer {
|
|
|
2235
2239
|
|
|
2236
2240
|
renderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;
|
|
2237
2241
|
|
|
2238
|
-
if ( ! renderTargetProperties.__autoAllocateDepthBuffer && ! _currentRenderTarget.isWebGLMultiviewRenderTarget ) {
|
|
2242
|
+
if ( ! renderTargetProperties.__autoAllocateDepthBuffer && ( ! _currentRenderTarget || ! _currentRenderTarget.isWebGLMultiviewRenderTarget ) ) {
|
|
2239
2243
|
|
|
2240
2244
|
// The multisample_render_to_texture extension doesn't work properly if there
|
|
2241
2245
|
// are midframe flushes and an external depth buffer. Disable use of the extension.
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
export default /* glsl */`
|
|
2
2
|
#ifdef USE_ALPHATEST
|
|
3
3
|
|
|
4
|
+
#ifdef ALPHA_TO_COVERAGE
|
|
5
|
+
|
|
6
|
+
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
|
|
7
|
+
if ( diffuseColor.a == 0.0 ) discard;
|
|
8
|
+
|
|
9
|
+
#else
|
|
10
|
+
|
|
4
11
|
if ( diffuseColor.a < alphaTest ) discard;
|
|
5
12
|
|
|
13
|
+
#endif
|
|
14
|
+
|
|
6
15
|
#endif
|
|
7
16
|
`;
|
|
@@ -3,29 +3,74 @@ export default /* glsl */`
|
|
|
3
3
|
|
|
4
4
|
vec4 plane;
|
|
5
5
|
|
|
6
|
-
#
|
|
7
|
-
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
|
|
6
|
+
#ifdef ALPHA_TO_COVERAGE
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
float distanceToPlane, distanceGradient;
|
|
9
|
+
float clipOpacity = 1.0;
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
#pragma unroll_loop_start
|
|
12
|
+
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
|
|
13
|
+
|
|
14
|
+
plane = clippingPlanes[ i ];
|
|
15
|
+
distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
|
|
16
|
+
distanceGradient = fwidth( distanceToPlane ) / 2.0;
|
|
17
|
+
clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
|
|
18
|
+
|
|
19
|
+
if ( clipOpacity == 0.0 ) discard;
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
#pragma unroll_loop_end
|
|
23
|
+
|
|
24
|
+
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
|
|
25
|
+
|
|
26
|
+
float unionClipOpacity = 1.0;
|
|
27
|
+
|
|
28
|
+
#pragma unroll_loop_start
|
|
29
|
+
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
|
|
30
|
+
|
|
31
|
+
plane = clippingPlanes[ i ];
|
|
32
|
+
distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
|
|
33
|
+
distanceGradient = fwidth( distanceToPlane ) / 2.0;
|
|
34
|
+
unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
|
|
14
35
|
|
|
15
|
-
|
|
36
|
+
}
|
|
37
|
+
#pragma unroll_loop_end
|
|
16
38
|
|
|
17
|
-
|
|
39
|
+
clipOpacity *= 1.0 - unionClipOpacity;
|
|
40
|
+
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
diffuseColor.a *= clipOpacity;
|
|
44
|
+
|
|
45
|
+
if ( diffuseColor.a == 0.0 ) discard;
|
|
46
|
+
|
|
47
|
+
#else
|
|
18
48
|
|
|
19
49
|
#pragma unroll_loop_start
|
|
20
|
-
for ( int i =
|
|
50
|
+
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
|
|
21
51
|
|
|
22
52
|
plane = clippingPlanes[ i ];
|
|
23
|
-
|
|
53
|
+
if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
|
|
24
54
|
|
|
25
55
|
}
|
|
26
56
|
#pragma unroll_loop_end
|
|
27
57
|
|
|
28
|
-
if
|
|
58
|
+
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
|
|
59
|
+
|
|
60
|
+
bool clipped = true;
|
|
61
|
+
|
|
62
|
+
#pragma unroll_loop_start
|
|
63
|
+
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
|
|
64
|
+
|
|
65
|
+
plane = clippingPlanes[ i ];
|
|
66
|
+
clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
#pragma unroll_loop_end
|
|
70
|
+
|
|
71
|
+
if ( clipped ) discard;
|
|
72
|
+
|
|
73
|
+
#endif
|
|
29
74
|
|
|
30
75
|
#endif
|
|
31
76
|
|
|
@@ -105,7 +105,11 @@ vec3 agxDefaultContrastApprox( vec3 x ) {
|
|
|
105
105
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
//
|
|
108
|
+
// AgX Tone Mapping implementation based on Filament, which in turn is based
|
|
109
|
+
// on Blender's implementation using rec 2020 primaries
|
|
110
|
+
// https://github.com/google/filament/pull/7236
|
|
111
|
+
// Inputs and outputs are encoded as Linear-sRGB.
|
|
112
|
+
|
|
109
113
|
vec3 AgXToneMapping( vec3 color ) {
|
|
110
114
|
|
|
111
115
|
// AgX constants
|
|
@@ -122,15 +126,16 @@ vec3 AgXToneMapping( vec3 color ) {
|
|
|
122
126
|
vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
|
|
123
127
|
);
|
|
124
128
|
|
|
125
|
-
|
|
126
|
-
|
|
129
|
+
// LOG2_MIN = -10.0
|
|
130
|
+
// LOG2_MAX = +6.5
|
|
131
|
+
// MIDDLE_GRAY = 0.18
|
|
132
|
+
const float AgxMinEv = - 12.47393; // log2( pow( 2, LOG2_MIN ) * MIDDLE_GRAY )
|
|
133
|
+
const float AgxMaxEv = 4.026069; // log2( pow( 2, LOG2_MAX ) * MIDDLE_GRAY )
|
|
127
134
|
|
|
128
|
-
// AGX Tone Mapping implementation based on Filament, which is in turn based
|
|
129
|
-
// on Blender's implementation for rec 2020 colors:
|
|
130
|
-
// https://github.com/google/filament/pull/7236
|
|
131
|
-
color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
|
|
132
135
|
color *= toneMappingExposure;
|
|
133
136
|
|
|
137
|
+
color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
|
|
138
|
+
|
|
134
139
|
color = AgXInsetMatrix * color;
|
|
135
140
|
|
|
136
141
|
// Log2 encoding
|
|
@@ -153,6 +158,9 @@ vec3 AgXToneMapping( vec3 color ) {
|
|
|
153
158
|
|
|
154
159
|
color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
|
|
155
160
|
|
|
161
|
+
// Gamut mapping. Simple clamp for now.
|
|
162
|
+
color = clamp( color, 0.0, 1.0 );
|
|
163
|
+
|
|
156
164
|
return color;
|
|
157
165
|
|
|
158
166
|
}
|
|
@@ -48,6 +48,7 @@ varying float vLineDistance;
|
|
|
48
48
|
|
|
49
49
|
void main() {
|
|
50
50
|
|
|
51
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
51
52
|
#include <clipping_planes_fragment>
|
|
52
53
|
|
|
53
54
|
if ( mod( vLineDistance, totalSize ) > dashSize ) {
|
|
@@ -57,7 +58,6 @@ void main() {
|
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
vec3 outgoingLight = vec3( 0.0 );
|
|
60
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
61
61
|
|
|
62
62
|
#include <logdepthbuf_fragment>
|
|
63
63
|
#include <map_fragment>
|
|
@@ -84,9 +84,9 @@ uniform float opacity;
|
|
|
84
84
|
|
|
85
85
|
void main() {
|
|
86
86
|
|
|
87
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
87
88
|
#include <clipping_planes_fragment>
|
|
88
89
|
|
|
89
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
90
90
|
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
91
91
|
vec3 totalEmissiveRadiance = emissive;
|
|
92
92
|
|
|
@@ -67,12 +67,14 @@ uniform float opacity;
|
|
|
67
67
|
|
|
68
68
|
void main() {
|
|
69
69
|
|
|
70
|
+
vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
|
|
71
|
+
|
|
70
72
|
#include <clipping_planes_fragment>
|
|
71
73
|
#include <logdepthbuf_fragment>
|
|
72
74
|
#include <normal_fragment_begin>
|
|
73
75
|
#include <normal_fragment_maps>
|
|
74
76
|
|
|
75
|
-
gl_FragColor = vec4( packNormalToRGB( normal ),
|
|
77
|
+
gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
|
|
76
78
|
|
|
77
79
|
#ifdef OPAQUE
|
|
78
80
|
|
|
@@ -86,9 +86,9 @@ uniform float opacity;
|
|
|
86
86
|
|
|
87
87
|
void main() {
|
|
88
88
|
|
|
89
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
89
90
|
#include <clipping_planes_fragment>
|
|
90
91
|
|
|
91
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
92
92
|
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
93
93
|
vec3 totalEmissiveRadiance = emissive;
|
|
94
94
|
|
|
@@ -157,9 +157,9 @@ varying vec3 vViewPosition;
|
|
|
157
157
|
|
|
158
158
|
void main() {
|
|
159
159
|
|
|
160
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
160
161
|
#include <clipping_planes_fragment>
|
|
161
162
|
|
|
162
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
163
163
|
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
164
164
|
vec3 totalEmissiveRadiance = emissive;
|
|
165
165
|
|
|
@@ -80,9 +80,9 @@ uniform float opacity;
|
|
|
80
80
|
|
|
81
81
|
void main() {
|
|
82
82
|
|
|
83
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
83
84
|
#include <clipping_planes_fragment>
|
|
84
85
|
|
|
85
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
86
86
|
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
87
87
|
vec3 totalEmissiveRadiance = emissive;
|
|
88
88
|
|
|
@@ -63,10 +63,10 @@ uniform float opacity;
|
|
|
63
63
|
|
|
64
64
|
void main() {
|
|
65
65
|
|
|
66
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
66
67
|
#include <clipping_planes_fragment>
|
|
67
68
|
|
|
68
69
|
vec3 outgoingLight = vec3( 0.0 );
|
|
69
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
70
70
|
|
|
71
71
|
#include <logdepthbuf_fragment>
|
|
72
72
|
#include <map_particle_fragment>
|
|
@@ -59,10 +59,10 @@ uniform float opacity;
|
|
|
59
59
|
|
|
60
60
|
void main() {
|
|
61
61
|
|
|
62
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
62
63
|
#include <clipping_planes_fragment>
|
|
63
64
|
|
|
64
65
|
vec3 outgoingLight = vec3( 0.0 );
|
|
65
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
66
66
|
|
|
67
67
|
#include <logdepthbuf_fragment>
|
|
68
68
|
#include <map_fragment>
|
|
@@ -86,7 +86,7 @@ function WebGLAttributes( gl, capabilities ) {
|
|
|
86
86
|
function updateBuffer( buffer, attribute, bufferType ) {
|
|
87
87
|
|
|
88
88
|
const array = attribute.array;
|
|
89
|
-
const updateRange = attribute._updateRange; // deprecated
|
|
89
|
+
const updateRange = attribute._updateRange; // @deprecated, r159
|
|
90
90
|
const updateRanges = attribute.updateRanges;
|
|
91
91
|
|
|
92
92
|
gl.bindBuffer( bufferType, buffer );
|
|
@@ -121,7 +121,7 @@ function WebGLAttributes( gl, capabilities ) {
|
|
|
121
121
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
// deprecated
|
|
124
|
+
// @deprecated, r159
|
|
125
125
|
if ( updateRange.count !== - 1 ) {
|
|
126
126
|
|
|
127
127
|
if ( isWebGL2 ) {
|
|
@@ -40,7 +40,7 @@ function WebGLCubeMaps( renderer ) {
|
|
|
40
40
|
|
|
41
41
|
if ( image && image.height > 0 ) {
|
|
42
42
|
|
|
43
|
-
const renderTarget = new WebGLCubeRenderTarget( image.height
|
|
43
|
+
const renderTarget = new WebGLCubeRenderTarget( image.height );
|
|
44
44
|
renderTarget.fromEquirectangularTexture( renderer, texture );
|
|
45
45
|
cubemaps.set( texture, renderTarget );
|
|
46
46
|
|