@damienmortini/three 0.1.157 → 0.1.161

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.
@@ -1445,7 +1445,7 @@ class GLTFTextureTransformExtension {
1445
1445
  /**
1446
1446
  * Specular-Glossiness Extension
1447
1447
  *
1448
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness
1448
+ * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Archived/KHR_materials_pbrSpecularGlossiness
1449
1449
  */
1450
1450
 
1451
1451
  /**
@@ -2253,7 +2253,7 @@ class GLTFParser {
2253
2253
 
2254
2254
  // Use an ImageBitmapLoader if imageBitmaps are supported. Moves much of the
2255
2255
  // expensive work of uploading a texture to the GPU off the main thread.
2256
- if ( typeof createImageBitmap !== 'undefined' && /Firefox/.test( navigator.userAgent ) === false ) {
2256
+ if ( typeof createImageBitmap !== 'undefined' && /Firefox|Safari/.test( navigator.userAgent ) === false ) {
2257
2257
 
2258
2258
  this.textureLoader = new ImageBitmapLoader( this.options.manager );
2259
2259
 
@@ -94,6 +94,14 @@ class KTX2Loader extends Loader {
94
94
  || renderer.extensions.has( 'WEBKIT_WEBGL_compressed_texture_pvrtc' )
95
95
  };
96
96
 
97
+
98
+ if ( renderer.capabilities.isWebGL2 ) {
99
+
100
+ // https://github.com/mrdoob/three.js/pull/22928
101
+ this.workerConfig.etc1Supported = false;
102
+
103
+ }
104
+
97
105
  return this;
98
106
 
99
107
  }
@@ -169,7 +177,7 @@ class KTX2Loader extends Loader {
169
177
 
170
178
  }
171
179
 
172
- _activeLoaders++;
180
+ _activeLoaders ++;
173
181
 
174
182
  }
175
183
 
@@ -265,7 +273,7 @@ class KTX2Loader extends Loader {
265
273
  URL.revokeObjectURL( this.workerSourceURL );
266
274
  this.workerPool.dispose();
267
275
 
268
- _activeLoaders--;
276
+ _activeLoaders --;
269
277
 
270
278
  return this;
271
279
 
@@ -519,8 +527,8 @@ KTX2Loader.BasisWorker = function () {
519
527
  {
520
528
  if: 'etc1Supported',
521
529
  basisFormat: [ BasisFormat.ETC1S, BasisFormat.UASTC_4x4 ],
522
- transcoderFormat: [ TranscoderFormat.ETC1, TranscoderFormat.ETC1 ],
523
- engineFormat: [ EngineFormat.RGB_ETC1_Format, EngineFormat.RGB_ETC1_Format ],
530
+ transcoderFormat: [ TranscoderFormat.ETC1 ],
531
+ engineFormat: [ EngineFormat.RGB_ETC1_Format ],
524
532
  priorityETC1S: 2,
525
533
  priorityUASTC: 4,
526
534
  needsPowerOfTwo: false,
@@ -560,6 +568,7 @@ KTX2Loader.BasisWorker = function () {
560
568
 
561
569
  if ( ! config[ opt.if ] ) continue;
562
570
  if ( ! opt.basisFormat.includes( basisFormat ) ) continue;
571
+ if ( hasAlpha && opt.transcoderFormat.length < 2 ) continue;
563
572
  if ( opt.needsPowerOfTwo && ! ( isPowerOfTwo( width ) && isPowerOfTwo( height ) ) ) continue;
564
573
 
565
574
  transcoderFormat = opt.transcoderFormat[ hasAlpha ? 1 : 0 ];
@@ -2,14 +2,12 @@ import {
2
2
  AdditiveBlending,
3
3
  Box2,
4
4
  BufferGeometry,
5
- ClampToEdgeWrapping,
6
5
  Color,
7
- DataTexture,
6
+ FramebufferTexture,
8
7
  InterleavedBuffer,
9
8
  InterleavedBufferAttribute,
10
9
  Mesh,
11
10
  MeshBasicMaterial,
12
- NearestFilter,
13
11
  RGBFormat,
14
12
  RawShaderMaterial,
15
13
  Vector2,
@@ -34,17 +32,8 @@ class Lensflare extends Mesh {
34
32
 
35
33
  // textures
36
34
 
37
- const tempMap = new DataTexture( new Uint8Array( 16 * 16 * 3 ), 16, 16, RGBFormat );
38
- tempMap.minFilter = NearestFilter;
39
- tempMap.magFilter = NearestFilter;
40
- tempMap.wrapS = ClampToEdgeWrapping;
41
- tempMap.wrapT = ClampToEdgeWrapping;
42
-
43
- const occlusionMap = new DataTexture( new Uint8Array( 16 * 16 * 3 ), 16, 16, RGBFormat );
44
- occlusionMap.minFilter = NearestFilter;
45
- occlusionMap.magFilter = NearestFilter;
46
- occlusionMap.wrapS = ClampToEdgeWrapping;
47
- occlusionMap.wrapT = ClampToEdgeWrapping;
35
+ const tempMap = new FramebufferTexture( 16, 16, RGBFormat );
36
+ const occlusionMap = new FramebufferTexture( 16, 16, RGBFormat );
48
37
 
49
38
  // material
50
39
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  export class WorkerPool {
6
6
 
7
- constructor ( pool = 4 ) {
7
+ constructor( pool = 4 ) {
8
8
 
9
9
  this.pool = pool;
10
10
  this.queue = [];
@@ -14,9 +14,9 @@ export class WorkerPool {
14
14
 
15
15
  }
16
16
 
17
- _initWorker ( workerId ) {
17
+ _initWorker( workerId ) {
18
18
 
19
- if ( !this.workers[ workerId ] ) {
19
+ if ( ! this.workers[ workerId ] ) {
20
20
 
21
21
  const worker = this.workerCreator();
22
22
  worker.addEventListener( 'message', this._onMessage.bind( this, workerId ) );
@@ -26,12 +26,12 @@ export class WorkerPool {
26
26
 
27
27
  }
28
28
 
29
- _getIdleWorker () {
29
+ _getIdleWorker() {
30
30
 
31
- for ( let i = 0 ; i < this.pool ; i ++ )
31
+ for ( let i = 0; i < this.pool; i ++ )
32
32
  if ( ! ( this.workerStatus & ( 1 << i ) ) ) return i;
33
33
 
34
- return -1;
34
+ return - 1;
35
35
 
36
36
  }
37
37
 
@@ -54,25 +54,25 @@ export class WorkerPool {
54
54
 
55
55
  }
56
56
 
57
- setWorkerCreator ( workerCreator ) {
57
+ setWorkerCreator( workerCreator ) {
58
58
 
59
59
  this.workerCreator = workerCreator;
60
60
 
61
61
  }
62
62
 
63
- setWorkerLimit ( pool ) {
63
+ setWorkerLimit( pool ) {
64
64
 
65
65
  this.pool = pool;
66
66
 
67
67
  }
68
68
 
69
- postMessage ( msg, transfer ) {
69
+ postMessage( msg, transfer ) {
70
70
 
71
71
  return new Promise( ( resolve ) => {
72
72
 
73
73
  const workerId = this._getIdleWorker();
74
74
 
75
- if ( workerId !== -1 ) {
75
+ if ( workerId !== - 1 ) {
76
76
 
77
77
  this._initWorker( workerId );
78
78
  this.workerStatus |= 1 << workerId;
@@ -89,7 +89,7 @@ export class WorkerPool {
89
89
 
90
90
  }
91
91
 
92
- dispose () {
92
+ dispose() {
93
93
 
94
94
  this.workers.forEach( ( worker ) => worker.terminate() );
95
95
  this.workersResolve.length = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@damienmortini/three",
3
- "version": "0.1.157",
3
+ "version": "0.1.161",
4
4
  "description": "Three.js helpers",
5
5
  "scripts": {
6
6
  "install": "npm run copyexamples",
@@ -25,9 +25,11 @@
25
25
  "bugs": "https://github.com/damienmortini/lib/issues",
26
26
  "homepage": "https://github.com/damienmortini/lib/tree/main/packages/three",
27
27
  "dependencies": {
28
- "@damienmortini/core": "^0.2.124",
29
- "fs-extra": "^10.0.0",
30
- "three": "0.135.0"
28
+ "@damienmortini/core": "^0.2.127",
29
+ "three": "0.136.0"
31
30
  },
32
- "gitHead": "ade945458d4e28b5eecafafea7d75ba4edc20ed8"
31
+ "devDependencies": {
32
+ "fs-extra": "^10.0.0"
33
+ },
34
+ "gitHead": "8228aa1a33d9fa907d7cdaf21a03d2f2e7660d82"
33
35
  }