three-stdlib 2.23.7 → 2.23.8

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.
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const THREE = require("three");
4
4
  const fflate = require("fflate");
5
+ const hasColorSpace = "colorSpace" in /* @__PURE__ */ new THREE.Texture();
5
6
  class EXRLoader extends THREE.DataTextureLoader {
6
7
  constructor(manager) {
7
8
  super(manager);
@@ -1200,7 +1201,7 @@ class EXRLoader extends THREE.DataTextureLoader {
1200
1201
  uncompress: null,
1201
1202
  getter: null,
1202
1203
  format: null,
1203
- encoding: null
1204
+ [hasColorSpace ? "colorSpace" : "encoding"]: null
1204
1205
  };
1205
1206
  switch (EXRHeader2.compression) {
1206
1207
  case "NO_COMPRESSION":
@@ -1284,13 +1285,14 @@ class EXRLoader extends THREE.DataTextureLoader {
1284
1285
  break;
1285
1286
  }
1286
1287
  EXRDecoder2.bytesPerLine = EXRDecoder2.width * EXRDecoder2.inputSize * EXRDecoder2.channels;
1287
- if (EXRDecoder2.outputChannels == 4) {
1288
+ if (EXRDecoder2.outputChannels == 4)
1288
1289
  EXRDecoder2.format = THREE.RGBAFormat;
1289
- EXRDecoder2.encoding = 3e3;
1290
- } else {
1290
+ else
1291
1291
  EXRDecoder2.format = THREE.RedFormat;
1292
+ if (hasColorSpace)
1293
+ EXRDecoder2.colorSpace = "srgb-linear";
1294
+ else
1292
1295
  EXRDecoder2.encoding = 3e3;
1293
- }
1294
1296
  return EXRDecoder2;
1295
1297
  }
1296
1298
  const bufferDataView = new DataView(buffer);
@@ -1327,7 +1329,7 @@ class EXRLoader extends THREE.DataTextureLoader {
1327
1329
  height: EXRDecoder.height,
1328
1330
  data: EXRDecoder.byteArray,
1329
1331
  format: EXRDecoder.format,
1330
- encoding: EXRDecoder.encoding,
1332
+ [hasColorSpace ? "colorSpace" : "encoding"]: EXRDecoder[hasColorSpace ? "colorSpace" : "encoding"],
1331
1333
  type: this.type
1332
1334
  };
1333
1335
  }
@@ -1337,8 +1339,8 @@ class EXRLoader extends THREE.DataTextureLoader {
1337
1339
  }
1338
1340
  load(url, onLoad, onProgress, onError) {
1339
1341
  function onLoadCallback(texture, texData) {
1340
- if ("colorSpace" in texture)
1341
- texture.colorSpace = texData.encoding === 3001 ? "srgb" : "srgb-linear";
1342
+ if (hasColorSpace)
1343
+ texture.colorSpace = texData.colorSpace;
1342
1344
  else
1343
1345
  texture.encoding = texData.encoding;
1344
1346
  texture.minFilter = THREE.LinearFilter;
@@ -1,5 +1,6 @@
1
- import { DataTextureLoader, HalfFloatType, DataUtils, FloatType, RGBAFormat, RedFormat, LinearFilter } from "three";
1
+ import { Texture, DataTextureLoader, HalfFloatType, DataUtils, FloatType, RGBAFormat, RedFormat, LinearFilter } from "three";
2
2
  import { unzlibSync } from "fflate";
3
+ const hasColorSpace = "colorSpace" in /* @__PURE__ */ new Texture();
3
4
  class EXRLoader extends DataTextureLoader {
4
5
  constructor(manager) {
5
6
  super(manager);
@@ -1198,7 +1199,7 @@ class EXRLoader extends DataTextureLoader {
1198
1199
  uncompress: null,
1199
1200
  getter: null,
1200
1201
  format: null,
1201
- encoding: null
1202
+ [hasColorSpace ? "colorSpace" : "encoding"]: null
1202
1203
  };
1203
1204
  switch (EXRHeader2.compression) {
1204
1205
  case "NO_COMPRESSION":
@@ -1282,13 +1283,14 @@ class EXRLoader extends DataTextureLoader {
1282
1283
  break;
1283
1284
  }
1284
1285
  EXRDecoder2.bytesPerLine = EXRDecoder2.width * EXRDecoder2.inputSize * EXRDecoder2.channels;
1285
- if (EXRDecoder2.outputChannels == 4) {
1286
+ if (EXRDecoder2.outputChannels == 4)
1286
1287
  EXRDecoder2.format = RGBAFormat;
1287
- EXRDecoder2.encoding = 3e3;
1288
- } else {
1288
+ else
1289
1289
  EXRDecoder2.format = RedFormat;
1290
+ if (hasColorSpace)
1291
+ EXRDecoder2.colorSpace = "srgb-linear";
1292
+ else
1290
1293
  EXRDecoder2.encoding = 3e3;
1291
- }
1292
1294
  return EXRDecoder2;
1293
1295
  }
1294
1296
  const bufferDataView = new DataView(buffer);
@@ -1325,7 +1327,7 @@ class EXRLoader extends DataTextureLoader {
1325
1327
  height: EXRDecoder.height,
1326
1328
  data: EXRDecoder.byteArray,
1327
1329
  format: EXRDecoder.format,
1328
- encoding: EXRDecoder.encoding,
1330
+ [hasColorSpace ? "colorSpace" : "encoding"]: EXRDecoder[hasColorSpace ? "colorSpace" : "encoding"],
1329
1331
  type: this.type
1330
1332
  };
1331
1333
  }
@@ -1335,8 +1337,8 @@ class EXRLoader extends DataTextureLoader {
1335
1337
  }
1336
1338
  load(url, onLoad, onProgress, onError) {
1337
1339
  function onLoadCallback(texture, texData) {
1338
- if ("colorSpace" in texture)
1339
- texture.colorSpace = texData.encoding === 3001 ? "srgb" : "srgb-linear";
1340
+ if (hasColorSpace)
1341
+ texture.colorSpace = texData.colorSpace;
1340
1342
  else
1341
1343
  texture.encoding = texData.encoding;
1342
1344
  texture.minFilter = LinearFilter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "three-stdlib",
3
- "version": "2.23.7",
3
+ "version": "2.23.8",
4
4
  "description": "stand-alone library of threejs examples",
5
5
  "keywords": [
6
6
  "three",