three-stdlib 2.23.15 → 2.24.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -81,6 +81,7 @@ class OrbitControls extends THREE.EventDispatcher {
81
81
  __publicField(this, "setAzimuthalAngle");
82
82
  __publicField(this, "getDistance");
83
83
  __publicField(this, "listenToKeyEvents");
84
+ __publicField(this, "stopListenToKeyEvents");
84
85
  __publicField(this, "saveState");
85
86
  __publicField(this, "reset");
86
87
  __publicField(this, "update");
@@ -134,6 +135,10 @@ class OrbitControls extends THREE.EventDispatcher {
134
135
  domElement2.addEventListener("keydown", onKeyDown);
135
136
  this._domElementKeyEvents = domElement2;
136
137
  };
138
+ this.stopListenToKeyEvents = () => {
139
+ this._domElementKeyEvents.removeEventListener("keydown", onKeyDown);
140
+ this._domElementKeyEvents = null;
141
+ };
137
142
  this.saveState = () => {
138
143
  scope.target0.copy(scope.target);
139
144
  scope.position0.copy(scope.object.position);
@@ -50,6 +50,7 @@ declare class OrbitControls extends EventDispatcher {
50
50
  setAzimuthalAngle: (x: number) => void;
51
51
  getDistance: () => number;
52
52
  listenToKeyEvents: (domElement: HTMLElement) => void;
53
+ stopListenToKeyEvents: () => void;
53
54
  saveState: () => void;
54
55
  reset: () => void;
55
56
  update: () => void;
@@ -79,6 +79,7 @@ class OrbitControls extends EventDispatcher {
79
79
  __publicField(this, "setAzimuthalAngle");
80
80
  __publicField(this, "getDistance");
81
81
  __publicField(this, "listenToKeyEvents");
82
+ __publicField(this, "stopListenToKeyEvents");
82
83
  __publicField(this, "saveState");
83
84
  __publicField(this, "reset");
84
85
  __publicField(this, "update");
@@ -132,6 +133,10 @@ class OrbitControls extends EventDispatcher {
132
133
  domElement2.addEventListener("keydown", onKeyDown);
133
134
  this._domElementKeyEvents = domElement2;
134
135
  };
136
+ this.stopListenToKeyEvents = () => {
137
+ this._domElementKeyEvents.removeEventListener("keydown", onKeyDown);
138
+ this._domElementKeyEvents = null;
139
+ };
135
140
  this.saveState = () => {
136
141
  scope.target0.copy(scope.target);
137
142
  scope.position0.copy(scope.object.position);
@@ -62,7 +62,7 @@ class AnaglyphEffect {
62
62
  " color.r, color.g, color.b,",
63
63
  " max( colorL.a, colorR.a ) );",
64
64
  " #include <tonemapping_fragment>",
65
- " #include <encodings_fragment>",
65
+ ` #include <${parseInt(THREE.REVISION.replace(/\D+/g, "")) >= 154 ? "colorspace_fragment" : "encodings_fragment"}>`,
66
66
  "}"
67
67
  ].join("\n")
68
68
  });
@@ -1,4 +1,4 @@
1
- import { Matrix3, OrthographicCamera, Scene, StereoCamera, LinearFilter, NearestFilter, RGBAFormat, WebGLRenderTarget, ShaderMaterial, Mesh, PlaneGeometry } from "three";
1
+ import { Matrix3, OrthographicCamera, Scene, StereoCamera, LinearFilter, NearestFilter, RGBAFormat, WebGLRenderTarget, ShaderMaterial, REVISION, Mesh, PlaneGeometry } from "three";
2
2
  class AnaglyphEffect {
3
3
  constructor(renderer, width = 512, height = 512) {
4
4
  this.colorMatrixLeft = new Matrix3().fromArray([
@@ -60,7 +60,7 @@ class AnaglyphEffect {
60
60
  " color.r, color.g, color.b,",
61
61
  " max( colorL.a, colorR.a ) );",
62
62
  " #include <tonemapping_fragment>",
63
- " #include <encodings_fragment>",
63
+ ` #include <${parseInt(REVISION.replace(/\D+/g, "")) >= 154 ? "colorspace_fragment" : "encodings_fragment"}>`,
64
64
  "}"
65
65
  ].join("\n")
66
66
  });
@@ -69,7 +69,7 @@ class OutlineEffect {
69
69
  " #include <logdepthbuf_fragment>",
70
70
  " gl_FragColor = vec4( outlineColor, outlineAlpha );",
71
71
  " #include <tonemapping_fragment>",
72
- " #include <encodings_fragment>",
72
+ ` #include <${parseInt(THREE.REVISION.replace(/\D+/g, "")) >= 154 ? "colorspace_fragment" : "encodings_fragment"}>`,
73
73
  " #include <fog_fragment>",
74
74
  " #include <premultiplied_alpha_fragment>",
75
75
  "}"
@@ -1,4 +1,4 @@
1
- import { Color, ShaderMaterial, UniformsUtils, UniformsLib, BackSide } from "three";
1
+ import { Color, REVISION, ShaderMaterial, UniformsUtils, UniformsLib, BackSide } from "three";
2
2
  class OutlineEffect {
3
3
  constructor(renderer, parameters = {}) {
4
4
  this.enabled = true;
@@ -67,7 +67,7 @@ class OutlineEffect {
67
67
  " #include <logdepthbuf_fragment>",
68
68
  " gl_FragColor = vec4( outlineColor, outlineAlpha );",
69
69
  " #include <tonemapping_fragment>",
70
- " #include <encodings_fragment>",
70
+ ` #include <${parseInt(REVISION.replace(/\D+/g, "")) >= 154 ? "colorspace_fragment" : "encodings_fragment"}>`,
71
71
  " #include <fog_fragment>",
72
72
  " #include <premultiplied_alpha_fragment>",
73
73
  "}"
@@ -33,7 +33,7 @@ class ParallaxBarrierEffect {
33
33
  " gl_FragColor = texture2D( mapRight, uv );",
34
34
  " }",
35
35
  " #include <tonemapping_fragment>",
36
- " #include <encodings_fragment>",
36
+ ` #include <${parseInt(THREE.REVISION.replace(/\D+/g, "")) >= 154 ? "colorspace_fragment" : "encodings_fragment"}>`,
37
37
  "}"
38
38
  ].join("\n")
39
39
  });
@@ -1,4 +1,4 @@
1
- import { OrthographicCamera, Scene, StereoCamera, LinearFilter, NearestFilter, RGBAFormat, WebGLRenderTarget, ShaderMaterial, Mesh, PlaneGeometry } from "three";
1
+ import { OrthographicCamera, Scene, StereoCamera, LinearFilter, NearestFilter, RGBAFormat, WebGLRenderTarget, ShaderMaterial, REVISION, Mesh, PlaneGeometry } from "three";
2
2
  class ParallaxBarrierEffect {
3
3
  constructor(renderer) {
4
4
  const _camera = new OrthographicCamera(-1, 1, 1, -1, 0, 1);
@@ -31,7 +31,7 @@ class ParallaxBarrierEffect {
31
31
  " gl_FragColor = texture2D( mapRight, uv );",
32
32
  " }",
33
33
  " #include <tonemapping_fragment>",
34
- " #include <encodings_fragment>",
34
+ ` #include <${parseInt(REVISION.replace(/\D+/g, "")) >= 154 ? "colorspace_fragment" : "encodings_fragment"}>`,
35
35
  "}"
36
36
  ].join("\n")
37
37
  });
@@ -409,7 +409,7 @@ class LineMaterial extends THREE.ShaderMaterial {
409
409
  gl_FragColor = vec4( diffuseColor.rgb, alpha );
410
410
 
411
411
  #include <tonemapping_fragment>
412
- #include <encodings_fragment>
412
+ #include <${parseInt(THREE.REVISION.replace(/\D+/g, "")) >= 154 ? "colorspace_fragment" : "encodings_fragment"}>
413
413
  #include <fog_fragment>
414
414
  #include <premultiplied_alpha_fragment>
415
415
 
@@ -1,4 +1,4 @@
1
- import { ShaderMaterial, UniformsUtils, UniformsLib, Vector2 } from "three";
1
+ import { ShaderMaterial, UniformsUtils, UniformsLib, Vector2, REVISION } from "three";
2
2
  class LineMaterial extends ShaderMaterial {
3
3
  constructor(parameters) {
4
4
  super({
@@ -407,7 +407,7 @@ class LineMaterial extends ShaderMaterial {
407
407
  gl_FragColor = vec4( diffuseColor.rgb, alpha );
408
408
 
409
409
  #include <tonemapping_fragment>
410
- #include <encodings_fragment>
410
+ #include <${parseInt(REVISION.replace(/\D+/g, "")) >= 154 ? "colorspace_fragment" : "encodings_fragment"}>
411
411
  #include <fog_fragment>
412
412
  #include <premultiplied_alpha_fragment>
413
413
 
@@ -107,7 +107,7 @@ class LDrawConditionalLineMaterial extends THREE.ShaderMaterial {
107
107
  outgoingLight = diffuseColor.rgb; // simple shader
108
108
  gl_FragColor = vec4(outgoingLight, diffuseColor.a);
109
109
  #include <tonemapping_fragment>
110
- #include <encodings_fragment>
110
+ #include <${parseInt(THREE.REVISION.replace(/\D+/g, "")) >= 154 ? "colorspace_fragment" : "encodings_fragment"}>
111
111
  #include <fog_fragment>
112
112
  #include <premultiplied_alpha_fragment>
113
113
  }
@@ -1,4 +1,4 @@
1
- import { Vector3, ShaderMaterial, UniformsUtils, UniformsLib, Color, LineSegments, Ray, FileLoader, Matrix4, Group, BufferGeometry, BufferAttribute, Mesh, Loader, MeshStandardMaterial, LineBasicMaterial } from "three";
1
+ import { Vector3, ShaderMaterial, UniformsUtils, UniformsLib, Color, REVISION, LineSegments, Ray, FileLoader, Matrix4, Group, BufferGeometry, BufferAttribute, Mesh, Loader, MeshStandardMaterial, LineBasicMaterial } from "three";
2
2
  const FINISH_TYPE_DEFAULT = 0;
3
3
  const FINISH_TYPE_CHROME = 1;
4
4
  const FINISH_TYPE_PEARLESCENT = 2;
@@ -105,7 +105,7 @@ class LDrawConditionalLineMaterial extends ShaderMaterial {
105
105
  outgoingLight = diffuseColor.rgb; // simple shader
106
106
  gl_FragColor = vec4(outgoingLight, diffuseColor.a);
107
107
  #include <tonemapping_fragment>
108
- #include <encodings_fragment>
108
+ #include <${parseInt(REVISION.replace(/\D+/g, "")) >= 154 ? "colorspace_fragment" : "encodings_fragment"}>
109
109
  #include <fog_fragment>
110
110
  #include <premultiplied_alpha_fragment>
111
111
  }
@@ -101,7 +101,7 @@ class GroundProjectedEnv extends THREE.Mesh {
101
101
  #endif
102
102
  gl_FragColor = vec4( outcolor, 1.0 );
103
103
  #include <tonemapping_fragment>
104
- #include <encodings_fragment>
104
+ #include <${parseInt(THREE.REVISION.replace(/\D+/g, "")) >= 154 ? "colorspace_fragment" : "encodings_fragment"}>
105
105
  }
106
106
  `;
107
107
  const uniforms = {
@@ -1,4 +1,4 @@
1
- import { Mesh, IcosahedronGeometry, ShaderMaterial, DoubleSide } from "three";
1
+ import { Mesh, REVISION, IcosahedronGeometry, ShaderMaterial, DoubleSide } from "three";
2
2
  const isCubeTexture = (def) => def && def.isCubeTexture;
3
3
  class GroundProjectedEnv extends Mesh {
4
4
  constructor(texture, options) {
@@ -99,7 +99,7 @@ class GroundProjectedEnv extends Mesh {
99
99
  #endif
100
100
  gl_FragColor = vec4( outcolor, 1.0 );
101
101
  #include <tonemapping_fragment>
102
- #include <encodings_fragment>
102
+ #include <${parseInt(REVISION.replace(/\D+/g, "")) >= 154 ? "colorspace_fragment" : "encodings_fragment"}>
103
103
  }
104
104
  `;
105
105
  const uniforms = {
@@ -194,7 +194,7 @@ __publicField(Reflector, "ReflectorShader", {
194
194
  gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );
195
195
 
196
196
  #include <tonemapping_fragment>
197
- #include <encodings_fragment>
197
+ #include <${parseInt(THREE.REVISION.replace(/\D+/g, "")) >= 154 ? "colorspace_fragment" : "encodings_fragment"}>
198
198
 
199
199
  }`
200
200
  )
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- import { Mesh, PerspectiveCamera, Color, Plane, Vector3, Matrix4, Vector4, WebGLRenderTarget, HalfFloatType, ShaderMaterial, UniformsUtils, NoToneMapping } from "three";
7
+ import { Mesh, REVISION, PerspectiveCamera, Color, Plane, Vector3, Matrix4, Vector4, WebGLRenderTarget, HalfFloatType, ShaderMaterial, UniformsUtils, NoToneMapping } from "three";
8
8
  const _Reflector = class extends Mesh {
9
9
  constructor(geometry, options = {}) {
10
10
  super(geometry);
@@ -192,7 +192,7 @@ __publicField(Reflector, "ReflectorShader", {
192
192
  gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );
193
193
 
194
194
  #include <tonemapping_fragment>
195
- #include <encodings_fragment>
195
+ #include <${parseInt(REVISION.replace(/\D+/g, "")) >= 154 ? "colorspace_fragment" : "encodings_fragment"}>
196
196
 
197
197
  }`
198
198
  )
@@ -207,7 +207,7 @@ __publicField(Refractor, "RefractorShader", {
207
207
  gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );
208
208
 
209
209
  #include <tonemapping_fragment>
210
- #include <encodings_fragment>
210
+ #include <${parseInt(THREE.REVISION.replace(/\D+/g, "")) >= 154 ? "colorspace_fragment" : "encodings_fragment"}>
211
211
 
212
212
  }`
213
213
  )
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- import { Mesh, PerspectiveCamera, Color, Plane, Matrix4, WebGLRenderTarget, HalfFloatType, ShaderMaterial, UniformsUtils, Vector3, Quaternion, Vector4, NoToneMapping } from "three";
7
+ import { Mesh, REVISION, PerspectiveCamera, Color, Plane, Matrix4, WebGLRenderTarget, HalfFloatType, ShaderMaterial, UniformsUtils, Vector3, Quaternion, Vector4, NoToneMapping } from "three";
8
8
  const _Refractor = class extends Mesh {
9
9
  constructor(geometry, options = {}) {
10
10
  super(geometry);
@@ -205,7 +205,7 @@ __publicField(Refractor, "RefractorShader", {
205
205
  gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );
206
206
 
207
207
  #include <tonemapping_fragment>
208
- #include <encodings_fragment>
208
+ #include <${parseInt(REVISION.replace(/\D+/g, "")) >= 154 ? "colorspace_fragment" : "encodings_fragment"}>
209
209
 
210
210
  }`
211
211
  )
package/objects/Sky.cjs CHANGED
@@ -176,7 +176,7 @@ const SkyShader = {
176
176
  gl_FragColor = vec4( retColor, 1.0 );
177
177
 
178
178
  #include <tonemapping_fragment>
179
- #include <encodings_fragment>
179
+ #include <${parseInt(THREE.REVISION.replace(/\D+/g, "")) >= 154 ? "colorspace_fragment" : "encodings_fragment"}>
180
180
 
181
181
  }
182
182
  `
package/objects/Sky.js CHANGED
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- import { Vector3, ShaderMaterial, UniformsUtils, BackSide, Mesh, BoxGeometry } from "three";
7
+ import { Vector3, REVISION, ShaderMaterial, UniformsUtils, BackSide, Mesh, BoxGeometry } from "three";
8
8
  const SkyShader = {
9
9
  uniforms: {
10
10
  turbidity: { value: 2 },
@@ -174,7 +174,7 @@ const SkyShader = {
174
174
  gl_FragColor = vec4( retColor, 1.0 );
175
175
 
176
176
  #include <tonemapping_fragment>
177
- #include <encodings_fragment>
177
+ #include <${parseInt(REVISION.replace(/\D+/g, "")) >= 154 ? "colorspace_fragment" : "encodings_fragment"}>
178
178
 
179
179
  }
180
180
  `
package/objects/Water.cjs CHANGED
@@ -150,7 +150,7 @@ class Water extends THREE.Mesh {
150
150
  gl_FragColor = vec4( outgoingLight, alpha );
151
151
 
152
152
  #include <tonemapping_fragment>
153
- #include <encodings_fragment>
153
+ #include <${parseInt(THREE.REVISION.replace(/\D+/g, "")) >= 154 ? "colorspace_fragment" : "encodings_fragment"}>
154
154
  #include <fog_fragment>
155
155
  }`
156
156
  )
package/objects/Water.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Mesh, Vector3, Color, FrontSide, Plane, Matrix4, Vector4, PerspectiveCamera, WebGLRenderTarget, UniformsUtils, UniformsLib, ShaderMaterial } from "three";
1
+ import { Mesh, Vector3, Color, FrontSide, Plane, Matrix4, Vector4, PerspectiveCamera, WebGLRenderTarget, UniformsUtils, UniformsLib, REVISION, ShaderMaterial } from "three";
2
2
  class Water extends Mesh {
3
3
  constructor(geometry, options = {}) {
4
4
  super(geometry);
@@ -148,7 +148,7 @@ class Water extends Mesh {
148
148
  gl_FragColor = vec4( outgoingLight, alpha );
149
149
 
150
150
  #include <tonemapping_fragment>
151
- #include <encodings_fragment>
151
+ #include <${parseInt(REVISION.replace(/\D+/g, "")) >= 154 ? "colorspace_fragment" : "encodings_fragment"}>
152
152
  #include <fog_fragment>
153
153
  }`
154
154
  )
@@ -247,7 +247,7 @@ __publicField(Water2, "WaterShader", {
247
247
  gl_FragColor = vec4( color, 1.0 ) * mix( refractColor, reflectColor, reflectance );
248
248
 
249
249
  #include <tonemapping_fragment>
250
- #include <encodings_fragment>
250
+ #include <${parseInt(THREE.REVISION.replace(/\D+/g, "")) >= 154 ? "colorspace_fragment" : "encodings_fragment"}>
251
251
  #include <fog_fragment>
252
252
 
253
253
  }`
package/objects/Water2.js CHANGED
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- import { Mesh, Vector4, Color, Vector2, Matrix4, Clock, ShaderMaterial, UniformsUtils, UniformsLib, RepeatWrapping } from "three";
7
+ import { Mesh, Vector4, REVISION, Color, Vector2, Matrix4, Clock, ShaderMaterial, UniformsUtils, UniformsLib, RepeatWrapping } from "three";
8
8
  import { Reflector } from "./Reflector.js";
9
9
  import { Refractor } from "./Refractor.js";
10
10
  const _Water2 = class extends Mesh {
@@ -245,7 +245,7 @@ __publicField(Water2, "WaterShader", {
245
245
  gl_FragColor = vec4( color, 1.0 ) * mix( refractColor, reflectColor, reflectance );
246
246
 
247
247
  #include <tonemapping_fragment>
248
- #include <encodings_fragment>
248
+ #include <${parseInt(REVISION.replace(/\D+/g, "")) >= 154 ? "colorspace_fragment" : "encodings_fragment"}>
249
249
  #include <fog_fragment>
250
250
 
251
251
  }`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "three-stdlib",
3
- "version": "2.23.15",
3
+ "version": "2.24.1",
4
4
  "description": "stand-alone library of threejs examples",
5
5
  "keywords": [
6
6
  "three",
@@ -560,7 +560,7 @@ class PackedPhongMaterial extends THREE.MeshPhongMaterial {
560
560
  THREE.ShaderChunk.envmap_fragment,
561
561
  "gl_FragColor = vec4( outgoingLight, diffuseColor.a );",
562
562
  THREE.ShaderChunk.tonemapping_fragment,
563
- THREE.ShaderChunk.encodings_fragment,
563
+ parseInt(THREE.REVISION.replace(/\D+/g, "")) >= 154 ? THREE.ShaderChunk.colorspace_fragment : THREE.ShaderChunk.encodings_fragment,
564
564
  THREE.ShaderChunk.fog_fragment,
565
565
  THREE.ShaderChunk.premultiplied_alpha_fragment,
566
566
  THREE.ShaderChunk.dithering_fragment,
@@ -1,4 +1,4 @@
1
- import { BufferAttribute, Matrix4, Vector3, Matrix3, MeshPhongMaterial, UniformsUtils, ShaderLib, ShaderChunk } from "three";
1
+ import { BufferAttribute, Matrix4, Vector3, Matrix3, MeshPhongMaterial, UniformsUtils, ShaderLib, ShaderChunk, REVISION } from "three";
2
2
  var GeometryCompressionUtils = {
3
3
  /**
4
4
  * Make the input mesh.geometry's normal attribute encoded and compressed by 3 different methods.
@@ -558,7 +558,7 @@ class PackedPhongMaterial extends MeshPhongMaterial {
558
558
  ShaderChunk.envmap_fragment,
559
559
  "gl_FragColor = vec4( outgoingLight, diffuseColor.a );",
560
560
  ShaderChunk.tonemapping_fragment,
561
- ShaderChunk.encodings_fragment,
561
+ parseInt(REVISION.replace(/\D+/g, "")) >= 154 ? ShaderChunk.colorspace_fragment : ShaderChunk.encodings_fragment,
562
562
  ShaderChunk.fog_fragment,
563
563
  ShaderChunk.premultiplied_alpha_fragment,
564
564
  ShaderChunk.dithering_fragment,