@woosh/meep-engine 2.117.13 → 2.117.16
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.
- package/build/meep.cjs +19 -19
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +19 -19
- package/package.json +1 -1
- package/src/engine/graphics/render/frame_graph/RenderGraph.d.ts +11 -0
- package/src/engine/graphics/render/frame_graph/RenderGraph.d.ts.map +1 -1
- package/src/engine/graphics/render/frame_graph/RenderGraph.js +27 -2
- package/src/engine/graphics/texture/Canvas2Sampler2D.d.ts +1 -7
- package/src/engine/graphics/texture/Canvas2Sampler2D.d.ts.map +1 -1
- package/src/engine/graphics/texture/Canvas2Sampler2D.js +2 -21
- package/src/engine/graphics/texture/canvasDataToSampler.d.ts +7 -0
- package/src/engine/graphics/texture/canvasDataToSampler.d.ts.map +1 -0
- package/src/engine/graphics/texture/canvasDataToSampler.js +19 -0
- package/src/engine/graphics/texture/sampler/convertTexture2Sampler2D.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/convertTexture2Sampler2D.js +2 -1
package/build/meep.module.js
CHANGED
|
@@ -51214,28 +51214,12 @@ function canvas2Sampler2D(canvas) {
|
|
|
51214
51214
|
context_cache.set(canvas, context);
|
|
51215
51215
|
}
|
|
51216
51216
|
|
|
51217
|
-
const
|
|
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
|
-
|
|
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
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
* @see https://github.com/skaarj1989/FrameGraph
|
|
4
4
|
*/
|
|
5
5
|
export class RenderGraph {
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @param {string} name
|
|
9
|
+
*/
|
|
10
|
+
constructor(name?: string);
|
|
11
|
+
/**
|
|
12
|
+
* Human-readable name, used for debugging and UI primarily.
|
|
13
|
+
* There is no uniqueness guarantee
|
|
14
|
+
* @type {string}
|
|
15
|
+
*/
|
|
16
|
+
name: string;
|
|
6
17
|
/**
|
|
7
18
|
*
|
|
8
19
|
* @type {RenderPass[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderGraph.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/RenderGraph.js"],"names":[],"mappings":"AAQA;;;GAGG;AACH;
|
|
1
|
+
{"version":3,"file":"RenderGraph.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/RenderGraph.js"],"names":[],"mappings":"AAQA;;;GAGG;AACH;IAoCI;;;OAGG;IACH,mBAFW,MAAM,EAOhB;IA5CD;;;;OAIG;IACH,MAFU,MAAM,CAEN;IAEV;;;;OAIG;IACH,iBAAc;IAEd;;;;OAIG;IACH,qBAAkB;IAElB;;;;OAIG;IACH,yBAAsB;IAEtB;;;;OAIG;IACH,4BAAyB;IAazB;;;;OAIG;IACH,qBAHW,MAAM,sBAahB;IAED;;;;OAIG;IACH,oBAHW,MAAM,qBAmBhB;IAED;;;;OAIG;IACH,qBAHW,MAAM,KAKhB;IAED;;;;OAIG;IACH,2BAHW,MAAM,2BAWhB;IAED;;;;;OAKG;IACH,6BAYC;IAED;;;;;;OAMG;IACH,4BAeC;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CAkBlB;IAED;;;;;;OAMG;IACH,2BALW,MAAM,wDAGJ,MAAM,CAUlB;IAED;;;OAGG;IACH,4BAHa,OAAO,CAQnB;IAED;;;;OAIG;IACH,qCA0BC;IAED;;;;;;OAMG;IACH,iEAFa,OAAO,CAOnB;IAED,gBA6FC;IAED;;;OAGG;IACH,uCA2CC;IAED;;;OAGG;IACH,eAFY,MAAM,CAiEjB;CACJ;8BAxd6B,oBAAoB;6BACrB,mBAAmB"}
|
|
@@ -11,6 +11,13 @@ import { ResourceNode } from "./ResourceNode.js";
|
|
|
11
11
|
* @see https://github.com/skaarj1989/FrameGraph
|
|
12
12
|
*/
|
|
13
13
|
export class RenderGraph {
|
|
14
|
+
/**
|
|
15
|
+
* Human-readable name, used for debugging and UI primarily.
|
|
16
|
+
* There is no uniqueness guarantee
|
|
17
|
+
* @type {string}
|
|
18
|
+
*/
|
|
19
|
+
name = "";
|
|
20
|
+
|
|
14
21
|
/**
|
|
15
22
|
*
|
|
16
23
|
* @type {RenderPass[]}
|
|
@@ -39,6 +46,17 @@ export class RenderGraph {
|
|
|
39
46
|
*/
|
|
40
47
|
__resource_registry = [];
|
|
41
48
|
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
* @param {string} name
|
|
52
|
+
*/
|
|
53
|
+
constructor(name = "") {
|
|
54
|
+
assert.isString(name, 'name');
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
this.name = name;
|
|
58
|
+
}
|
|
59
|
+
|
|
42
60
|
/**
|
|
43
61
|
*
|
|
44
62
|
* @param {number} id Resource Node ID
|
|
@@ -94,6 +112,10 @@ export class RenderGraph {
|
|
|
94
112
|
* @param {T} descriptor
|
|
95
113
|
*/
|
|
96
114
|
create_resource(name, descriptor) {
|
|
115
|
+
assert.isString(name, 'name');
|
|
116
|
+
assert.defined(descriptor, 'descriptor');
|
|
117
|
+
assert.notNull(descriptor, 'descriptor');
|
|
118
|
+
|
|
97
119
|
const resource = this._createResourceEntry(descriptor);
|
|
98
120
|
|
|
99
121
|
return this._createResourceNode(name, resource.resource_id).id;
|
|
@@ -106,6 +128,8 @@ export class RenderGraph {
|
|
|
106
128
|
* @private
|
|
107
129
|
*/
|
|
108
130
|
_createResourceEntry(descriptor) {
|
|
131
|
+
assert.defined(descriptor, 'descriptor');
|
|
132
|
+
assert.notNull(descriptor, 'descriptor');
|
|
109
133
|
|
|
110
134
|
const entry = new ResourceEntry();
|
|
111
135
|
|
|
@@ -125,6 +149,7 @@ export class RenderGraph {
|
|
|
125
149
|
* @private
|
|
126
150
|
*/
|
|
127
151
|
_createResourceNode(name, resource_id) {
|
|
152
|
+
assert.isString(name, 'name');
|
|
128
153
|
assert.isNonNegativeInteger(resource_id, 'resource_id');
|
|
129
154
|
|
|
130
155
|
const n = new ResourceNode();
|
|
@@ -310,7 +335,7 @@ export class RenderGraph {
|
|
|
310
335
|
}
|
|
311
336
|
|
|
312
337
|
// calculate lifetimes
|
|
313
|
-
for (let i = 0; i < pass_node_count; i++){
|
|
338
|
+
for (let i = 0; i < pass_node_count; i++) {
|
|
314
339
|
const pass = pass_nodes[i];
|
|
315
340
|
if (pass.ref_count === 0) {
|
|
316
341
|
// unused pass
|
|
@@ -369,7 +394,7 @@ export class RenderGraph {
|
|
|
369
394
|
const resource_entries = this.__resource_registry;
|
|
370
395
|
const resource_entry_count = resource_entries.length;
|
|
371
396
|
|
|
372
|
-
for (let entry_index = 0; entry_index < resource_entry_count; entry_index++){
|
|
397
|
+
for (let entry_index = 0; entry_index < resource_entry_count; entry_index++) {
|
|
373
398
|
const entry = resource_entries[entry_index];
|
|
374
399
|
|
|
375
400
|
if (entry.last === node && entry.isTransient()) {
|
|
@@ -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":"
|
|
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
|
|
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
|
-
|
|
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 @@
|
|
|
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":"
|
|
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
|
-
|
|
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";
|