three-stdlib 2.23.6 → 2.23.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const THREE = require("three");
4
+ class CapsuleGeometry extends THREE.LatheGeometry {
5
+ constructor(radius = 1, length = 1, capSegments = 4, radialSegments = 8) {
6
+ const path = new THREE.Path();
7
+ path.absarc(0, -length / 2, radius, Math.PI * 1.5, 0);
8
+ path.absarc(0, length / 2, radius, 0, Math.PI * 0.5);
9
+ super(path.getPoints(capSegments), radialSegments);
10
+ this.type = "CapsuleGeometry";
11
+ this.parameters = {
12
+ radius,
13
+ height: length,
14
+ capSegments,
15
+ radialSegments
16
+ };
17
+ }
18
+ static fromJSON(data) {
19
+ return new CapsuleGeometry(data.radius, data.length, data.capSegments, data.radialSegments);
20
+ }
21
+ }
22
+ exports.CapsuleGeometry = CapsuleGeometry;
@@ -0,0 +1,22 @@
1
+ import { LatheGeometry, Path } from "three";
2
+ class CapsuleGeometry extends LatheGeometry {
3
+ constructor(radius = 1, length = 1, capSegments = 4, radialSegments = 8) {
4
+ const path = new Path();
5
+ path.absarc(0, -length / 2, radius, Math.PI * 1.5, 0);
6
+ path.absarc(0, length / 2, radius, 0, Math.PI * 0.5);
7
+ super(path.getPoints(capSegments), radialSegments);
8
+ this.type = "CapsuleGeometry";
9
+ this.parameters = {
10
+ radius,
11
+ height: length,
12
+ capSegments,
13
+ radialSegments
14
+ };
15
+ }
16
+ static fromJSON(data) {
17
+ return new CapsuleGeometry(data.radius, data.length, data.capSegments, data.radialSegments);
18
+ }
19
+ }
20
+ export {
21
+ CapsuleGeometry
22
+ };
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const THREE = require("three");
4
+ const CapsuleGeometry = require("../_polyfill/CapsuleGeometry.cjs");
4
5
  class MMDPhysics {
5
6
  /**
6
7
  * @param {THREE.SkinnedMesh} mesh
@@ -815,7 +816,7 @@ class MMDPhysicsHelper extends THREE.Object3D {
815
816
  case 1:
816
817
  return new THREE.BoxGeometry(param2.width * 2, param2.height * 2, param2.depth * 2, 8, 8, 8);
817
818
  case 2:
818
- return new THREE.CapsuleGeometry(param2.width, param2.height, 8, 16);
819
+ return new CapsuleGeometry.CapsuleGeometry(param2.width, param2.height, 8, 16);
819
820
  default:
820
821
  return null;
821
822
  }
@@ -1,4 +1,5 @@
1
- import { Vector3, Matrix4, Quaternion, Euler, Bone, Object3D, MeshBasicMaterial, Color, CapsuleGeometry, BoxGeometry, SphereGeometry, Mesh } from "three";
1
+ import { Vector3, Matrix4, Quaternion, Euler, Bone, Object3D, MeshBasicMaterial, Color, BoxGeometry, SphereGeometry, Mesh } from "three";
2
+ import { CapsuleGeometry } from "../_polyfill/CapsuleGeometry.js";
2
3
  class MMDPhysics {
3
4
  /**
4
5
  * @param {THREE.SkinnedMesh} mesh
@@ -560,7 +560,7 @@ class GLTFWriter {
560
560
  context.putImageData(composite, 0, 0);
561
561
  const reference = metalnessMap || roughnessMap;
562
562
  const texture = reference.clone();
563
- texture.source = new THREE.Source(canvas);
563
+ texture.source = new THREE.Texture(canvas).source;
564
564
  if ("colorSpace" in texture)
565
565
  texture.colorSpace = "";
566
566
  else
@@ -1,4 +1,4 @@
1
- import { PlaneGeometry, ShaderMaterial, Uniform, Mesh, PerspectiveCamera, Scene, WebGLRenderer, Texture, NearestFilter, NearestMipmapNearestFilter, NearestMipmapLinearFilter, LinearFilter, LinearMipmapNearestFilter, LinearMipmapLinearFilter, ClampToEdgeWrapping, RepeatWrapping, MirroredRepeatWrapping, Color, MathUtils, Vector3, CompressedTexture, Source, RGBAFormat, DoubleSide, REVISION, BufferAttribute, PropertyBinding, InterpolateDiscrete, Matrix4, InterpolateLinear } from "three";
1
+ import { PlaneGeometry, ShaderMaterial, Uniform, Mesh, PerspectiveCamera, Scene, WebGLRenderer, Texture, NearestFilter, NearestMipmapNearestFilter, NearestMipmapLinearFilter, LinearFilter, LinearMipmapNearestFilter, LinearMipmapLinearFilter, ClampToEdgeWrapping, RepeatWrapping, MirroredRepeatWrapping, Color, MathUtils, Vector3, CompressedTexture, RGBAFormat, DoubleSide, REVISION, BufferAttribute, PropertyBinding, InterpolateDiscrete, Matrix4, InterpolateLinear } from "three";
2
2
  let _renderer;
3
3
  let fullscreenQuadGeometry;
4
4
  let fullscreenQuadMaterial;
@@ -558,7 +558,7 @@ class GLTFWriter {
558
558
  context.putImageData(composite, 0, 0);
559
559
  const reference = metalnessMap || roughnessMap;
560
560
  const texture = reference.clone();
561
- texture.source = new Source(canvas);
561
+ texture.source = new Texture(canvas).source;
562
562
  if ("colorSpace" in texture)
563
563
  texture.colorSpace = "";
564
564
  else
@@ -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.6",
3
+ "version": "2.23.8",
4
4
  "description": "stand-alone library of threejs examples",
5
5
  "keywords": [
6
6
  "three",