@iwer/devui 0.2.0 → 0.2.1

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.
@@ -5834,7 +5834,7 @@
5834
5834
  * Copyright 2010-2024 Three.js Authors
5835
5835
  * SPDX-License-Identifier: MIT
5836
5836
  */
5837
- const REVISION = '169';
5837
+ const REVISION = '168';
5838
5838
  const CullFaceNone = 0;
5839
5839
  const CullFaceBack = 1;
5840
5840
  const CullFaceFront = 2;
@@ -7139,38 +7139,6 @@
7139
7139
 
7140
7140
  }
7141
7141
 
7142
- function toNormalizedProjectionMatrix( projectionMatrix ) {
7143
-
7144
- const m = projectionMatrix.elements;
7145
-
7146
- // Convert [-1, 1] to [0, 1] projection matrix
7147
- m[ 2 ] = 0.5 * m[ 2 ] + 0.5 * m[ 3 ];
7148
- m[ 6 ] = 0.5 * m[ 6 ] + 0.5 * m[ 7 ];
7149
- m[ 10 ] = 0.5 * m[ 10 ] + 0.5 * m[ 11 ];
7150
- m[ 14 ] = 0.5 * m[ 14 ] + 0.5 * m[ 15 ];
7151
-
7152
- }
7153
-
7154
- function toReversedProjectionMatrix( projectionMatrix ) {
7155
-
7156
- const m = projectionMatrix.elements;
7157
- const isPerspectiveMatrix = m[ 11 ] === - 1;
7158
-
7159
- // Reverse [0, 1] projection matrix
7160
- if ( isPerspectiveMatrix ) {
7161
-
7162
- m[ 10 ] = - m[ 10 ] - 1;
7163
- m[ 14 ] = - m[ 14 ];
7164
-
7165
- } else {
7166
-
7167
- m[ 10 ] = - m[ 10 ];
7168
- m[ 14 ] = - m[ 14 ] + 1;
7169
-
7170
- }
7171
-
7172
- }
7173
-
7174
7142
  /**
7175
7143
  * Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping
7176
7144
  * or clipping. Based on W3C specifications for sRGB and Display P3,
@@ -13730,10 +13698,6 @@
13730
13698
  const _vbp = /*@__PURE__*/ new Vector3();
13731
13699
  const _vcp = /*@__PURE__*/ new Vector3();
13732
13700
 
13733
- const _v40 = /*@__PURE__*/ new Vector4();
13734
- const _v41 = /*@__PURE__*/ new Vector4();
13735
- const _v42 = /*@__PURE__*/ new Vector4();
13736
-
13737
13701
  class Triangle {
13738
13702
 
13739
13703
  constructor( a = new Vector3(), b = new Vector3(), c = new Vector3() ) {
@@ -13828,25 +13792,6 @@
13828
13792
 
13829
13793
  }
13830
13794
 
13831
- static getInterpolatedAttribute( attr, i1, i2, i3, barycoord, target ) {
13832
-
13833
- _v40.setScalar( 0 );
13834
- _v41.setScalar( 0 );
13835
- _v42.setScalar( 0 );
13836
-
13837
- _v40.fromBufferAttribute( attr, i1 );
13838
- _v41.fromBufferAttribute( attr, i2 );
13839
- _v42.fromBufferAttribute( attr, i3 );
13840
-
13841
- target.setScalar( 0 );
13842
- target.addScaledVector( _v40, barycoord.x );
13843
- target.addScaledVector( _v41, barycoord.y );
13844
- target.addScaledVector( _v42, barycoord.z );
13845
-
13846
- return target;
13847
-
13848
- }
13849
-
13850
13795
  static isFrontFacing( a, b, c, direction ) {
13851
13796
 
13852
13797
  _v0$2.subVectors( c, b );
@@ -15293,6 +15238,7 @@
15293
15238
  this.normalized = normalized;
15294
15239
 
15295
15240
  this.usage = StaticDrawUsage;
15241
+ this._updateRange = { offset: 0, count: - 1 };
15296
15242
  this.updateRanges = [];
15297
15243
  this.gpuType = FloatType;
15298
15244
 
@@ -15308,6 +15254,13 @@
15308
15254
 
15309
15255
  }
15310
15256
 
15257
+ get updateRange() {
15258
+
15259
+ warnOnce( 'THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159
15260
+ return this._updateRange;
15261
+
15262
+ }
15263
+
15311
15264
  setUsage( value ) {
15312
15265
 
15313
15266
  this.usage = value;
@@ -16748,6 +16701,14 @@
16748
16701
  const _tempA = /*@__PURE__*/ new Vector3();
16749
16702
  const _morphA = /*@__PURE__*/ new Vector3();
16750
16703
 
16704
+ const _uvA$1 = /*@__PURE__*/ new Vector2();
16705
+ const _uvB$1 = /*@__PURE__*/ new Vector2();
16706
+ const _uvC$1 = /*@__PURE__*/ new Vector2();
16707
+
16708
+ const _normalA = /*@__PURE__*/ new Vector3();
16709
+ const _normalB = /*@__PURE__*/ new Vector3();
16710
+ const _normalC = /*@__PURE__*/ new Vector3();
16711
+
16751
16712
  const _intersectionPoint = /*@__PURE__*/ new Vector3();
16752
16713
  const _intersectionPointWorld = /*@__PURE__*/ new Vector3();
16753
16714
 
@@ -17090,24 +17051,33 @@
17090
17051
 
17091
17052
  if ( intersection ) {
17092
17053
 
17093
- const barycoord = new Vector3();
17094
- Triangle.getBarycoord( _intersectionPoint, _vA$1, _vB$1, _vC$1, barycoord );
17095
-
17096
17054
  if ( uv ) {
17097
17055
 
17098
- intersection.uv = Triangle.getInterpolatedAttribute( uv, a, b, c, barycoord, new Vector2() );
17056
+ _uvA$1.fromBufferAttribute( uv, a );
17057
+ _uvB$1.fromBufferAttribute( uv, b );
17058
+ _uvC$1.fromBufferAttribute( uv, c );
17059
+
17060
+ intersection.uv = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );
17099
17061
 
17100
17062
  }
17101
17063
 
17102
17064
  if ( uv1 ) {
17103
17065
 
17104
- intersection.uv1 = Triangle.getInterpolatedAttribute( uv1, a, b, c, barycoord, new Vector2() );
17066
+ _uvA$1.fromBufferAttribute( uv1, a );
17067
+ _uvB$1.fromBufferAttribute( uv1, b );
17068
+ _uvC$1.fromBufferAttribute( uv1, c );
17069
+
17070
+ intersection.uv1 = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );
17105
17071
 
17106
17072
  }
17107
17073
 
17108
17074
  if ( normal ) {
17109
17075
 
17110
- intersection.normal = Triangle.getInterpolatedAttribute( normal, a, b, c, barycoord, new Vector3() );
17076
+ _normalA.fromBufferAttribute( normal, a );
17077
+ _normalB.fromBufferAttribute( normal, b );
17078
+ _normalC.fromBufferAttribute( normal, c );
17079
+
17080
+ intersection.normal = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _normalA, _normalB, _normalC, new Vector3() );
17111
17081
 
17112
17082
  if ( intersection.normal.dot( ray.direction ) > 0 ) {
17113
17083
 
@@ -17128,7 +17098,6 @@
17128
17098
  Triangle.getNormal( _vA$1, _vB$1, _vC$1, face.normal );
17129
17099
 
17130
17100
  intersection.face = face;
17131
- intersection.barycoord = barycoord;
17132
17101
 
17133
17102
  }
17134
17103
 
@@ -18772,60 +18741,19 @@
18772
18741
  function updateBuffer( buffer, attribute, bufferType ) {
18773
18742
 
18774
18743
  const array = attribute.array;
18744
+ const updateRange = attribute._updateRange; // @deprecated, r159
18775
18745
  const updateRanges = attribute.updateRanges;
18776
18746
 
18777
18747
  gl.bindBuffer( bufferType, buffer );
18778
18748
 
18779
- if ( updateRanges.length === 0 ) {
18749
+ if ( updateRange.count === - 1 && updateRanges.length === 0 ) {
18780
18750
 
18781
18751
  // Not using update ranges
18782
18752
  gl.bufferSubData( bufferType, 0, array );
18783
18753
 
18784
- } else {
18785
-
18786
- // Before applying update ranges, we merge any adjacent / overlapping
18787
- // ranges to reduce load on `gl.bufferSubData`. Empirically, this has led
18788
- // to performance improvements for applications which make heavy use of
18789
- // update ranges. Likely due to GPU command overhead.
18790
- //
18791
- // Note that to reduce garbage collection between frames, we merge the
18792
- // update ranges in-place. This is safe because this method will clear the
18793
- // update ranges once updated.
18794
-
18795
- updateRanges.sort( ( a, b ) => a.start - b.start );
18796
-
18797
- // To merge the update ranges in-place, we work from left to right in the
18798
- // existing updateRanges array, merging ranges. This may result in a final
18799
- // array which is smaller than the original. This index tracks the last
18800
- // index representing a merged range, any data after this index can be
18801
- // trimmed once the merge algorithm is completed.
18802
- let mergeIndex = 0;
18803
-
18804
- for ( let i = 1; i < updateRanges.length; i ++ ) {
18805
-
18806
- const previousRange = updateRanges[ mergeIndex ];
18807
- const range = updateRanges[ i ];
18808
-
18809
- // We add one here to merge adjacent ranges. This is safe because ranges
18810
- // operate over positive integers.
18811
- if ( range.start <= previousRange.start + previousRange.count + 1 ) {
18812
-
18813
- previousRange.count = Math.max(
18814
- previousRange.count,
18815
- range.start + range.count - previousRange.start
18816
- );
18817
-
18818
- } else {
18819
-
18820
- ++ mergeIndex;
18821
- updateRanges[ mergeIndex ] = range;
18822
-
18823
- }
18824
-
18825
- }
18754
+ }
18826
18755
 
18827
- // Trim the array to only contain the merged ranges.
18828
- updateRanges.length = mergeIndex + 1;
18756
+ if ( updateRanges.length !== 0 ) {
18829
18757
 
18830
18758
  for ( let i = 0, l = updateRanges.length; i < l; i ++ ) {
18831
18759
 
@@ -18840,6 +18768,16 @@
18840
18768
 
18841
18769
  }
18842
18770
 
18771
+ // @deprecated, r159
18772
+ if ( updateRange.count !== - 1 ) {
18773
+
18774
+ gl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,
18775
+ array, updateRange.offset, updateRange.count );
18776
+
18777
+ updateRange.count = - 1; // reset range
18778
+
18779
+ }
18780
+
18843
18781
  attribute.onUploadCallback();
18844
18782
 
18845
18783
  }
@@ -19297,7 +19235,7 @@
19297
19235
 
19298
19236
  const fragment$2 = "uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}";
19299
19237
 
19300
- const vertex$1 = "uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";
19238
+ const vertex$1 = "uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";
19301
19239
 
19302
19240
  const fragment$1 = "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}";
19303
19241
 
@@ -21063,14 +21001,6 @@
21063
21001
  }
21064
21002
 
21065
21003
  const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
21066
- const reverseDepthBuffer = parameters.reverseDepthBuffer === true && extensions.has( 'EXT_clip_control' );
21067
-
21068
- if ( reverseDepthBuffer === true ) {
21069
-
21070
- const ext = extensions.get( 'EXT_clip_control' );
21071
- ext.clipControlEXT( ext.LOWER_LEFT_EXT, ext.ZERO_TO_ONE_EXT );
21072
-
21073
- }
21074
21004
 
21075
21005
  const maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );
21076
21006
  const maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );
@@ -21098,7 +21028,6 @@
21098
21028
 
21099
21029
  precision: precision,
21100
21030
  logarithmicDepthBuffer: logarithmicDepthBuffer,
21101
- reverseDepthBuffer: reverseDepthBuffer,
21102
21031
 
21103
21032
  maxTextures: maxTextures,
21104
21033
  maxVertexTextures: maxVertexTextures,
@@ -25116,7 +25045,6 @@
25116
25045
  parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
25117
25046
 
25118
25047
  parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
25119
- parameters.reverseDepthBuffer ? '#define USE_REVERSEDEPTHBUF' : '',
25120
25048
 
25121
25049
  'uniform mat4 modelMatrix;',
25122
25050
  'uniform mat4 modelViewMatrix;',
@@ -25282,7 +25210,6 @@
25282
25210
  parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
25283
25211
 
25284
25212
  parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
25285
- parameters.reverseDepthBuffer ? '#define USE_REVERSEDEPTHBUF' : '',
25286
25213
 
25287
25214
  'uniform mat4 viewMatrix;',
25288
25215
  'uniform vec3 cameraPosition;',
@@ -25675,7 +25602,6 @@
25675
25602
  const programs = [];
25676
25603
 
25677
25604
  const logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;
25678
- const reverseDepthBuffer = capabilities.reverseDepthBuffer;
25679
25605
  const SUPPORTS_VERTEX_TEXTURES = capabilities.vertexTextures;
25680
25606
 
25681
25607
  let precision = capabilities.precision;
@@ -25967,7 +25893,6 @@
25967
25893
 
25968
25894
  sizeAttenuation: material.sizeAttenuation === true,
25969
25895
  logarithmicDepthBuffer: logarithmicDepthBuffer,
25970
- reverseDepthBuffer: reverseDepthBuffer,
25971
25896
 
25972
25897
  skinning: object.isSkinnedMesh === true,
25973
25898
 
@@ -26187,40 +26112,38 @@
26187
26112
  _programLayers.enable( 2 );
26188
26113
  if ( parameters.logarithmicDepthBuffer )
26189
26114
  _programLayers.enable( 3 );
26190
- if ( parameters.reverseDepthBuffer )
26191
- _programLayers.enable( 4 );
26192
26115
  if ( parameters.skinning )
26193
- _programLayers.enable( 5 );
26116
+ _programLayers.enable( 4 );
26194
26117
  if ( parameters.morphTargets )
26195
- _programLayers.enable( 6 );
26118
+ _programLayers.enable( 5 );
26196
26119
  if ( parameters.morphNormals )
26197
- _programLayers.enable( 7 );
26120
+ _programLayers.enable( 6 );
26198
26121
  if ( parameters.morphColors )
26199
- _programLayers.enable( 8 );
26122
+ _programLayers.enable( 7 );
26200
26123
  if ( parameters.premultipliedAlpha )
26201
- _programLayers.enable( 9 );
26124
+ _programLayers.enable( 8 );
26202
26125
  if ( parameters.shadowMapEnabled )
26203
- _programLayers.enable( 10 );
26126
+ _programLayers.enable( 9 );
26204
26127
  if ( parameters.doubleSided )
26205
- _programLayers.enable( 11 );
26128
+ _programLayers.enable( 10 );
26206
26129
  if ( parameters.flipSided )
26207
- _programLayers.enable( 12 );
26130
+ _programLayers.enable( 11 );
26208
26131
  if ( parameters.useDepthPacking )
26209
- _programLayers.enable( 13 );
26132
+ _programLayers.enable( 12 );
26210
26133
  if ( parameters.dithering )
26211
- _programLayers.enable( 14 );
26134
+ _programLayers.enable( 13 );
26212
26135
  if ( parameters.transmission )
26213
- _programLayers.enable( 15 );
26136
+ _programLayers.enable( 14 );
26214
26137
  if ( parameters.sheen )
26215
- _programLayers.enable( 16 );
26138
+ _programLayers.enable( 15 );
26216
26139
  if ( parameters.opaque )
26217
- _programLayers.enable( 17 );
26140
+ _programLayers.enable( 16 );
26218
26141
  if ( parameters.pointsUvs )
26219
- _programLayers.enable( 18 );
26142
+ _programLayers.enable( 17 );
26220
26143
  if ( parameters.decodeVideoTexture )
26221
- _programLayers.enable( 19 );
26144
+ _programLayers.enable( 18 );
26222
26145
  if ( parameters.alphaToCoverage )
26223
- _programLayers.enable( 20 );
26146
+ _programLayers.enable( 19 );
26224
26147
 
26225
26148
  array.push( _programLayers.mask );
26226
26149
 
@@ -27778,18 +27701,6 @@
27778
27701
 
27779
27702
  }
27780
27703
 
27781
- const reversedFuncs = {
27782
- [ NeverDepth ]: AlwaysDepth,
27783
- [ LessDepth ]: GreaterDepth,
27784
- [ EqualDepth ]: NotEqualDepth,
27785
- [ LessEqualDepth ]: GreaterEqualDepth,
27786
-
27787
- [ AlwaysDepth ]: NeverDepth,
27788
- [ GreaterDepth ]: LessDepth,
27789
- [ NotEqualDepth ]: EqualDepth,
27790
- [ GreaterEqualDepth ]: LessEqualDepth,
27791
- };
27792
-
27793
27704
  function WebGLState( gl ) {
27794
27705
 
27795
27706
  function ColorBuffer() {
@@ -27854,7 +27765,6 @@
27854
27765
  function DepthBuffer() {
27855
27766
 
27856
27767
  let locked = false;
27857
- let reversed = false;
27858
27768
 
27859
27769
  let currentDepthMask = null;
27860
27770
  let currentDepthFunc = null;
@@ -27862,12 +27772,6 @@
27862
27772
 
27863
27773
  return {
27864
27774
 
27865
- setReversed: function ( value ) {
27866
-
27867
- reversed = value;
27868
-
27869
- },
27870
-
27871
27775
  setTest: function ( depthTest ) {
27872
27776
 
27873
27777
  if ( depthTest ) {
@@ -27895,8 +27799,6 @@
27895
27799
 
27896
27800
  setFunc: function ( depthFunc ) {
27897
27801
 
27898
- if ( reversed ) depthFunc = reversedFuncs[ depthFunc ];
27899
-
27900
27802
  if ( currentDepthFunc !== depthFunc ) {
27901
27803
 
27902
27804
  switch ( depthFunc ) {
@@ -29367,28 +29269,6 @@
29367
29269
 
29368
29270
  }
29369
29271
 
29370
- if ( glFormat === _gl.RGB_INTEGER ) {
29371
-
29372
- if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RGB8UI;
29373
- if ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.RGB16UI;
29374
- if ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.RGB32UI;
29375
- if ( glType === _gl.BYTE ) internalFormat = _gl.RGB8I;
29376
- if ( glType === _gl.SHORT ) internalFormat = _gl.RGB16I;
29377
- if ( glType === _gl.INT ) internalFormat = _gl.RGB32I;
29378
-
29379
- }
29380
-
29381
- if ( glFormat === _gl.RGBA_INTEGER ) {
29382
-
29383
- if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RGBA8UI;
29384
- if ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.RGBA16UI;
29385
- if ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.RGBA32UI;
29386
- if ( glType === _gl.BYTE ) internalFormat = _gl.RGBA8I;
29387
- if ( glType === _gl.SHORT ) internalFormat = _gl.RGBA16I;
29388
- if ( glType === _gl.INT ) internalFormat = _gl.RGBA32I;
29389
-
29390
- }
29391
-
29392
29272
  if ( glFormat === _gl.RGB ) {
29393
29273
 
29394
29274
  if ( glType === _gl.UNSIGNED_INT_5_9_9_9_REV ) internalFormat = _gl.RGB9_E5;
@@ -33982,7 +33862,6 @@ void main() {
33982
33862
 
33983
33863
  // camera matrices cache
33984
33864
 
33985
- const _currentProjectionMatrix = new Matrix4();
33986
33865
  const _projScreenMatrix = new Matrix4();
33987
33866
 
33988
33867
  const _vector3 = new Vector3();
@@ -34078,8 +33957,6 @@ void main() {
34078
33957
 
34079
33958
  state = new WebGLState( _gl );
34080
33959
 
34081
- if ( capabilities.reverseDepthBuffer ) state.buffers.depth.setReversed( true );
34082
-
34083
33960
  info = new WebGLInfo( _gl );
34084
33961
  properties = new WebGLProperties();
34085
33962
  textures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );
@@ -34379,13 +34256,7 @@ void main() {
34379
34256
 
34380
34257
  }
34381
34258
 
34382
- if ( depth ) {
34383
-
34384
- bits |= _gl.DEPTH_BUFFER_BIT;
34385
- _gl.clearDepth( this.capabilities.reverseDepthBuffer ? 0 : 1 );
34386
-
34387
- }
34388
-
34259
+ if ( depth ) bits |= _gl.DEPTH_BUFFER_BIT;
34389
34260
  if ( stencil ) {
34390
34261
 
34391
34262
  bits |= _gl.STENCIL_BUFFER_BIT;
@@ -34774,12 +34645,6 @@ void main() {
34774
34645
 
34775
34646
  scene.traverse( function ( object ) {
34776
34647
 
34777
- if ( ! ( object.isMesh || object.isPoints || object.isLine || object.isSprite ) ) {
34778
-
34779
- return;
34780
-
34781
- }
34782
-
34783
34648
  const material = object.material;
34784
34649
 
34785
34650
  if ( material ) {
@@ -35766,21 +35631,7 @@ void main() {
35766
35631
 
35767
35632
  // common camera uniforms
35768
35633
 
35769
- if ( capabilities.reverseDepthBuffer ) {
35770
-
35771
- _currentProjectionMatrix.copy( camera.projectionMatrix );
35772
-
35773
- toNormalizedProjectionMatrix( _currentProjectionMatrix );
35774
- toReversedProjectionMatrix( _currentProjectionMatrix );
35775
-
35776
- p_uniforms.setValue( _gl, 'projectionMatrix', _currentProjectionMatrix );
35777
-
35778
- } else {
35779
-
35780
- p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
35781
-
35782
- }
35783
-
35634
+ p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
35784
35635
  p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
35785
35636
 
35786
35637
  const uCamPos = p_uniforms.map.cameraPosition;
@@ -36261,55 +36112,61 @@ void main() {
36261
36112
 
36262
36113
  if ( framebuffer ) {
36263
36114
 
36264
- const texture = renderTarget.texture;
36265
- const textureFormat = texture.format;
36266
- const textureType = texture.type;
36115
+ state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
36267
36116
 
36268
- if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
36117
+ try {
36269
36118
 
36270
- throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.' );
36119
+ const texture = renderTarget.texture;
36120
+ const textureFormat = texture.format;
36121
+ const textureType = texture.type;
36271
36122
 
36272
- }
36123
+ if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
36273
36124
 
36274
- if ( ! capabilities.textureTypeReadable( textureType ) ) {
36125
+ throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.' );
36275
36126
 
36276
- throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.' );
36127
+ }
36277
36128
 
36278
- }
36129
+ if ( ! capabilities.textureTypeReadable( textureType ) ) {
36279
36130
 
36280
- // the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)
36281
- if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
36131
+ throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.' );
36282
36132
 
36283
- // set the active frame buffer to the one we want to read
36284
- state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
36133
+ }
36285
36134
 
36286
- const glBuffer = _gl.createBuffer();
36287
- _gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
36288
- _gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );
36289
- _gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), 0 );
36135
+ // the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)
36136
+ if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
36290
36137
 
36291
- // reset the frame buffer to the currently set buffer before waiting
36292
- const currFramebuffer = _currentRenderTarget !== null ? properties.get( _currentRenderTarget ).__webglFramebuffer : null;
36293
- state.bindFramebuffer( _gl.FRAMEBUFFER, currFramebuffer );
36138
+ const glBuffer = _gl.createBuffer();
36139
+ _gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
36140
+ _gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );
36141
+ _gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), 0 );
36142
+ _gl.flush();
36294
36143
 
36295
- // check if the commands have finished every 8 ms
36296
- const sync = _gl.fenceSync( _gl.SYNC_GPU_COMMANDS_COMPLETE, 0 );
36144
+ // check if the commands have finished every 8 ms
36145
+ const sync = _gl.fenceSync( _gl.SYNC_GPU_COMMANDS_COMPLETE, 0 );
36146
+ await probeAsync( _gl, sync, 4 );
36297
36147
 
36298
- _gl.flush();
36148
+ try {
36299
36149
 
36300
- await probeAsync( _gl, sync, 4 );
36150
+ _gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
36151
+ _gl.getBufferSubData( _gl.PIXEL_PACK_BUFFER, 0, buffer );
36301
36152
 
36302
- // read the data and delete the buffer
36303
- _gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
36304
- _gl.getBufferSubData( _gl.PIXEL_PACK_BUFFER, 0, buffer );
36305
- _gl.deleteBuffer( glBuffer );
36306
- _gl.deleteSync( sync );
36153
+ } finally {
36307
36154
 
36308
- return buffer;
36155
+ _gl.deleteBuffer( glBuffer );
36156
+ _gl.deleteSync( sync );
36309
36157
 
36310
- } else {
36158
+ }
36159
+
36160
+ return buffer;
36161
+
36162
+ }
36163
+
36164
+ } finally {
36311
36165
 
36312
- throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.' );
36166
+ // restore framebuffer of current render target if necessary
36167
+
36168
+ const framebuffer = ( _currentRenderTarget !== null ) ? properties.get( _currentRenderTarget ).__webglFramebuffer : null;
36169
+ state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
36313
36170
 
36314
36171
  }
36315
36172
 
@@ -36991,7 +36848,6 @@ void main() {
36991
36848
  index: a,
36992
36849
  face: null,
36993
36850
  faceIndex: null,
36994
- barycoord: null,
36995
36851
  object: object
36996
36852
 
36997
36853
  };
@@ -37128,19 +36984,12 @@ void main() {
37128
36984
 
37129
36985
  // faces
37130
36986
 
37131
- if ( radiusTop > 0 ) {
37132
-
37133
- indices.push( a, b, d );
37134
- groupCount += 3;
37135
-
37136
- }
37137
-
37138
- if ( radiusBottom > 0 ) {
36987
+ indices.push( a, b, d );
36988
+ indices.push( b, c, d );
37139
36989
 
37140
- indices.push( b, c, d );
37141
- groupCount += 3;
36990
+ // update group counter
37142
36991
 
37143
- }
36992
+ groupCount += 6;
37144
36993
 
37145
36994
  }
37146
36995
 
@@ -38122,35 +37971,6 @@ void main() {
38122
37971
 
38123
37972
  }
38124
37973
 
38125
- class Controls extends EventDispatcher {
38126
-
38127
- constructor( object, domElement = null ) {
38128
-
38129
- super();
38130
-
38131
- this.object = object;
38132
- this.domElement = domElement;
38133
-
38134
- this.enabled = true;
38135
-
38136
- this.state = - 1;
38137
-
38138
- this.keys = {};
38139
- this.mouseButtons = { LEFT: null, MIDDLE: null, RIGHT: null };
38140
- this.touches = { ONE: null, TWO: null };
38141
-
38142
- }
38143
-
38144
- connect() {}
38145
-
38146
- disconnect() {}
38147
-
38148
- dispose() {}
38149
-
38150
- update( /* delta */ ) {}
38151
-
38152
- }
38153
-
38154
37974
  if ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {
38155
37975
 
38156
37976
  __THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'register', { detail: {
@@ -38189,22 +38009,32 @@ void main() {
38189
38009
  const _mouseUpEvent = { type: 'mouseUp', mode: null };
38190
38010
  const _objectChangeEvent = { type: 'objectChange' };
38191
38011
 
38192
- class TransformControls extends Controls {
38012
+ class TransformControls extends Object3D {
38013
+
38014
+ constructor( camera, domElement ) {
38015
+
38016
+ super();
38017
+
38018
+ if ( domElement === undefined ) {
38193
38019
 
38194
- constructor( camera, domElement = null ) {
38020
+ console.warn( 'THREE.TransformControls: The second parameter "domElement" is now mandatory.' );
38021
+ domElement = document;
38195
38022
 
38196
- super( undefined, domElement );
38023
+ }
38024
+
38025
+ this.isTransformControls = true;
38197
38026
 
38198
- const root = new TransformControlsRoot( this );
38199
- this._root = root;
38027
+ this.visible = false;
38028
+ this.domElement = domElement;
38029
+ this.domElement.style.touchAction = 'none'; // disable touch scroll
38200
38030
 
38201
- const gizmo = new TransformControlsGizmo();
38202
- this._gizmo = gizmo;
38203
- root.add( gizmo );
38031
+ const _gizmo = new TransformControlsGizmo();
38032
+ this._gizmo = _gizmo;
38033
+ this.add( _gizmo );
38204
38034
 
38205
- const plane = new TransformControlsPlane();
38206
- this._plane = plane;
38207
- root.add( plane );
38035
+ const _plane = new TransformControlsPlane();
38036
+ this._plane = _plane;
38037
+ this.add( _plane );
38208
38038
 
38209
38039
  const scope = this;
38210
38040
 
@@ -38226,8 +38056,8 @@ void main() {
38226
38056
  if ( propValue !== value ) {
38227
38057
 
38228
38058
  propValue = value;
38229
- plane[ propName ] = value;
38230
- gizmo[ propName ] = value;
38059
+ _plane[ propName ] = value;
38060
+ _gizmo[ propName ] = value;
38231
38061
 
38232
38062
  scope.dispatchEvent( { type: propName + '-changed', value: value } );
38233
38063
  scope.dispatchEvent( _changeEvent );
@@ -38239,8 +38069,8 @@ void main() {
38239
38069
  } );
38240
38070
 
38241
38071
  scope[ propName ] = defaultValue;
38242
- plane[ propName ] = defaultValue;
38243
- gizmo[ propName ] = defaultValue;
38072
+ _plane[ propName ] = defaultValue;
38073
+ _gizmo[ propName ] = defaultValue;
38244
38074
 
38245
38075
  }
38246
38076
 
@@ -38315,38 +38145,50 @@ void main() {
38315
38145
  this._onPointerMove = onPointerMove.bind( this );
38316
38146
  this._onPointerUp = onPointerUp.bind( this );
38317
38147
 
38318
- if ( domElement !== null ) {
38148
+ this.domElement.addEventListener( 'pointerdown', this._onPointerDown );
38149
+ this.domElement.addEventListener( 'pointermove', this._onPointerHover );
38150
+ this.domElement.addEventListener( 'pointerup', this._onPointerUp );
38319
38151
 
38320
- this.connect();
38152
+ }
38321
38153
 
38322
- }
38154
+ // updateMatrixWorld updates key transformation variables
38155
+ updateMatrixWorld( force ) {
38323
38156
 
38324
- }
38157
+ if ( this.object !== undefined ) {
38325
38158
 
38326
- connect() {
38159
+ this.object.updateMatrixWorld();
38327
38160
 
38328
- this.domElement.addEventListener( 'pointerdown', this._onPointerDown );
38329
- this.domElement.addEventListener( 'pointermove', this._onPointerHover );
38330
- this.domElement.addEventListener( 'pointerup', this._onPointerUp );
38161
+ if ( this.object.parent === null ) {
38331
38162
 
38332
- this.domElement.style.touchAction = 'none'; // disable touch scroll
38163
+ console.error( 'TransformControls: The attached 3D object must be a part of the scene graph.' );
38333
38164
 
38334
- }
38165
+ } else {
38335
38166
 
38336
- disconnect() {
38167
+ this.object.parent.matrixWorld.decompose( this._parentPosition, this._parentQuaternion, this._parentScale );
38337
38168
 
38338
- this.domElement.removeEventListener( 'pointerdown', this._onPointerDown );
38339
- this.domElement.removeEventListener( 'pointermove', this._onPointerHover );
38340
- this.domElement.removeEventListener( 'pointermove', this._onPointerMove );
38341
- this.domElement.removeEventListener( 'pointerup', this._onPointerUp );
38169
+ }
38342
38170
 
38343
- this.domElement.style.touchAction = 'auto';
38171
+ this.object.matrixWorld.decompose( this.worldPosition, this.worldQuaternion, this._worldScale );
38344
38172
 
38345
- }
38173
+ this._parentQuaternionInv.copy( this._parentQuaternion ).invert();
38174
+ this._worldQuaternionInv.copy( this.worldQuaternion ).invert();
38175
+
38176
+ }
38177
+
38178
+ this.camera.updateMatrixWorld();
38179
+ this.camera.matrixWorld.decompose( this.cameraPosition, this.cameraQuaternion, this._cameraScale );
38180
+
38181
+ if ( this.camera.isOrthographicCamera ) {
38182
+
38183
+ this.camera.getWorldDirection( this.eye ).negate();
38184
+
38185
+ } else {
38186
+
38187
+ this.eye.copy( this.cameraPosition ).sub( this.worldPosition ).normalize();
38346
38188
 
38347
- getHelper() {
38189
+ }
38348
38190
 
38349
- return this._root;
38191
+ super.updateMatrixWorld( force );
38350
38192
 
38351
38193
  }
38352
38194
 
@@ -38686,7 +38528,10 @@ void main() {
38686
38528
 
38687
38529
  dispose() {
38688
38530
 
38689
- this.disconnect();
38531
+ this.domElement.removeEventListener( 'pointerdown', this._onPointerDown );
38532
+ this.domElement.removeEventListener( 'pointermove', this._onPointerHover );
38533
+ this.domElement.removeEventListener( 'pointermove', this._onPointerMove );
38534
+ this.domElement.removeEventListener( 'pointerup', this._onPointerUp );
38690
38535
 
38691
38536
  this.traverse( function ( child ) {
38692
38537
 
@@ -38701,7 +38546,7 @@ void main() {
38701
38546
  attach( object ) {
38702
38547
 
38703
38548
  this.object = object;
38704
- this._root.visible = true;
38549
+ this.visible = true;
38705
38550
 
38706
38551
  return this;
38707
38552
 
@@ -38711,10 +38556,9 @@ void main() {
38711
38556
  detach() {
38712
38557
 
38713
38558
  this.object = undefined;
38559
+ this.visible = false;
38714
38560
  this.axis = null;
38715
38561
 
38716
- this._root.visible = false;
38717
-
38718
38562
  return this;
38719
38563
 
38720
38564
  }
@@ -38907,64 +38751,6 @@ void main() {
38907
38751
  const _v2 = new Vector3();
38908
38752
  const _v3 = new Vector3();
38909
38753
 
38910
- class TransformControlsRoot extends Object3D {
38911
-
38912
- constructor( controls ) {
38913
-
38914
- super();
38915
-
38916
- this.isTransformControlsRoot = true;
38917
-
38918
- this.controls = controls;
38919
- this.visible = false;
38920
-
38921
- }
38922
-
38923
- // updateMatrixWorld updates key transformation variables
38924
- updateMatrixWorld( force ) {
38925
-
38926
- const controls = this.controls;
38927
-
38928
- if ( controls.object !== undefined ) {
38929
-
38930
- controls.object.updateMatrixWorld();
38931
-
38932
- if ( controls.object.parent === null ) {
38933
-
38934
- console.error( 'TransformControls: The attached 3D object must be a part of the scene graph.' );
38935
-
38936
- } else {
38937
-
38938
- controls.object.parent.matrixWorld.decompose( controls._parentPosition, controls._parentQuaternion, controls._parentScale );
38939
-
38940
- }
38941
-
38942
- controls.object.matrixWorld.decompose( controls.worldPosition, controls.worldQuaternion, controls._worldScale );
38943
-
38944
- controls._parentQuaternionInv.copy( controls._parentQuaternion ).invert();
38945
- controls._worldQuaternionInv.copy( controls.worldQuaternion ).invert();
38946
-
38947
- }
38948
-
38949
- controls.camera.updateMatrixWorld();
38950
- controls.camera.matrixWorld.decompose( controls.cameraPosition, controls.cameraQuaternion, controls._cameraScale );
38951
-
38952
- if ( controls.camera.isOrthographicCamera ) {
38953
-
38954
- controls.camera.getWorldDirection( controls.eye ).negate();
38955
-
38956
- } else {
38957
-
38958
- controls.eye.copy( controls.cameraPosition ).sub( controls.worldPosition ).normalize();
38959
-
38960
- }
38961
-
38962
- super.updateMatrixWorld( force );
38963
-
38964
- }
38965
-
38966
- }
38967
-
38968
38754
  class TransformControlsGizmo extends Object3D {
38969
38755
 
38970
38756
  constructor() {