@woosh/meep-engine 2.117.13 → 2.117.14

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.
@@ -51214,28 +51214,12 @@ function canvas2Sampler2D(canvas) {
51214
51214
  context_cache.set(canvas, context);
51215
51215
  }
51216
51216
 
51217
- const result = new Sampler2D(null, 4, width, height);
51218
-
51219
- canvasDataToSampler(result, context);
51220
-
51221
- return result;
51222
-
51223
- }
51224
-
51225
- /**
51226
- *
51227
- * @param {Sampler2D} target
51228
- * @param {CanvasRenderingContext2D} ctx
51229
- */
51230
- function canvasDataToSampler(target, ctx) {
51231
- const width = target.width;
51232
- const height = target.height;
51233
-
51234
- const imageData = ctx.getImageData(0, 0, width, height);
51217
+ const imageData = context.getImageData(0, 0, width, height);
51235
51218
 
51236
51219
  const data = imageData.data;
51237
51220
 
51238
- target.data = data;
51221
+ return new Sampler2D(data, 4, width, height);
51222
+
51239
51223
  }
51240
51224
 
51241
51225
  /**
@@ -67703,6 +67687,22 @@ const CopyShader = {
67703
67687
 
67704
67688
  };
67705
67689
 
67690
+ /**
67691
+ *
67692
+ * @param {Sampler2D} target
67693
+ * @param {CanvasRenderingContext2D} ctx
67694
+ */
67695
+ function canvasDataToSampler(target, ctx) {
67696
+ const width = target.width;
67697
+ const height = target.height;
67698
+
67699
+ const imageData = ctx.getImageData(0, 0, width, height);
67700
+
67701
+ const data = imageData.data;
67702
+
67703
+ target.data = data;
67704
+ }
67705
+
67706
67706
  /**
67707
67707
  * WebGL constant, declared explicitly to avoid issues with later THREE.js versions where it is absent
67708
67708
  * @type {number}
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "description": "Fully featured ECS game engine written in JavaScript",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.117.13",
8
+ "version": "2.117.14",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -1,15 +1,9 @@
1
- /**
2
- *
3
- * @param {Sampler2D} target
4
- * @param {CanvasRenderingContext2D} ctx
5
- */
6
- export function canvasDataToSampler(target: Sampler2D, ctx: CanvasRenderingContext2D): void;
7
1
  export default canvas2Sampler2D;
8
- import { Sampler2D } from './sampler/Sampler2D.js';
9
2
  /**
10
3
  *
11
4
  * @param {HTMLCanvasElement} canvas
12
5
  * @returns {Sampler2D}
13
6
  */
14
7
  declare function canvas2Sampler2D(canvas: HTMLCanvasElement): Sampler2D;
8
+ import { Sampler2D } from './sampler/Sampler2D.js';
15
9
  //# sourceMappingURL=Canvas2Sampler2D.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Canvas2Sampler2D.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/texture/Canvas2Sampler2D.js"],"names":[],"mappings":"AAiCA;;;;GAIG;AACH,4CAHW,SAAS,OACT,wBAAwB,QAalC;;0BAhDyB,wBAAwB;AAQlD;;;;GAIG;AACH,0CAHW,iBAAiB,GACf,SAAS,CAmBrB"}
1
+ {"version":3,"file":"Canvas2Sampler2D.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/texture/Canvas2Sampler2D.js"],"names":[],"mappings":";AAQA;;;;GAIG;AACH,0CAHW,iBAAiB,GACf,SAAS,CAmBrB;0BA9ByB,wBAAwB"}
@@ -1,4 +1,3 @@
1
- import { assert } from "../../../core/assert.js";
2
1
  import { Sampler2D } from './sampler/Sampler2D.js';
3
2
 
4
3
  /**
@@ -23,30 +22,12 @@ function canvas2Sampler2D(canvas) {
23
22
  context_cache.set(canvas, context);
24
23
  }
25
24
 
26
- const result = new Sampler2D(null, 4, width, height);
27
-
28
- canvasDataToSampler(result, context);
29
-
30
- return result;
31
-
32
- }
33
-
34
- /**
35
- *
36
- * @param {Sampler2D} target
37
- * @param {CanvasRenderingContext2D} ctx
38
- */
39
- export function canvasDataToSampler(target, ctx) {
40
- const width = target.width;
41
- const height = target.height;
42
-
43
- const imageData = ctx.getImageData(0, 0, width, height);
25
+ const imageData = context.getImageData(0, 0, width, height);
44
26
 
45
27
  const data = imageData.data;
46
28
 
47
- assert.equal(data.length, target.height * target.width * target.itemSize);
29
+ return new Sampler2D(data, 4, width, height);
48
30
 
49
- target.data = data;
50
31
  }
51
32
 
52
33
  export default canvas2Sampler2D;
@@ -0,0 +1,7 @@
1
+ /**
2
+ *
3
+ * @param {Sampler2D} target
4
+ * @param {CanvasRenderingContext2D} ctx
5
+ */
6
+ export function canvasDataToSampler(target: Sampler2D, ctx: CanvasRenderingContext2D): void;
7
+ //# sourceMappingURL=canvasDataToSampler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canvasDataToSampler.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/texture/canvasDataToSampler.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,4DAFW,wBAAwB,QAalC"}
@@ -0,0 +1,19 @@
1
+ import { assert } from "../../../core/assert.js";
2
+
3
+ /**
4
+ *
5
+ * @param {Sampler2D} target
6
+ * @param {CanvasRenderingContext2D} ctx
7
+ */
8
+ export function canvasDataToSampler(target, ctx) {
9
+ const width = target.width;
10
+ const height = target.height;
11
+
12
+ const imageData = ctx.getImageData(0, 0, width, height);
13
+
14
+ const data = imageData.data;
15
+
16
+ assert.equal(data.length, target.height * target.width * target.itemSize);
17
+
18
+ target.data = data;
19
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"convertTexture2Sampler2D.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/convertTexture2Sampler2D.js"],"names":[],"mappings":"AAuEA;;;;;;;GAOG;AACH,mEALW,MAAM,WACN,MAAM,UACN,OAAO,GACN,SAAS,CAyFpB;0BA9JyB,gBAAgB"}
1
+ {"version":3,"file":"convertTexture2Sampler2D.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/convertTexture2Sampler2D.js"],"names":[],"mappings":"AAwEA;;;;;;;GAOG;AACH,mEALW,MAAM,WACN,MAAM,UACN,OAAO,GACN,SAAS,CAyFpB;0BA9JyB,gBAAgB"}
@@ -3,7 +3,8 @@ import ImageFilter from "../../filter/ImageFilter.js";
3
3
  import { sampler2d_flipY_in_place } from "../../filter/sampler2d_flipY_in_place.js";
4
4
  import CopyShader from "../../postprocess/threejs/shaders/CopyShader.js";
5
5
  import { WebGLRendererPool } from "../../render/RendererPool.js";
6
- import { canvasDataToSampler } from "../Canvas2Sampler2D.js";
6
+
7
+ import { canvasDataToSampler } from "../canvasDataToSampler.js";
7
8
  import { formatToChannelCount } from "../formatToChannelCount.js";
8
9
  import { sampler2d_scale } from "./resize/sampler2d_scale.js";
9
10
  import { Sampler2D } from "./Sampler2D.js";