@woosh/meep-engine 2.128.12 → 2.128.13

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/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "description": "Pure JavaScript game engine. Fully featured and production ready.",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.128.12",
8
+ "version": "2.128.13",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -1 +1 @@
1
- {"version":3,"file":"RenderGraph.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/RenderGraph.js"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH;IA6BI;;;OAGG;IACH,mBAFW,MAAM,EAOhB;IArCD;;;;OAIG;IACH,MAFU,MAAM,CAEN;IAEV;;;;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;;;;;OAKG;IACH,2BAJW,MAAM,oBAEJ,MAAM,CAWlB;IAED;;;;;OAKG;IACH,6BAYC;IAED;;;;;;OAMG;IACH,4BAeC;IAED;;;;OAIG;IACH,wBAHW,MAAM,GACJ,MAAM,CAkBlB;IAED;;;;;;OAMG;IACH,2BALW,MAAM,wDAGJ,MAAM,CAUlB;IAED;;;OAGG;IACH,4BAHa,OAAO,CAQnB;IAED;;;;;;;OAOG;IACH,eALW,MAAM,4BAGJ,iBAAiB,CA2B7B;IAED;;;;;;OAMG;IACH,iEAFa,OAAO,CAQnB;IAED,gBA6FC;IAED;;;OAGG;IACH,uCA2CC;IAED;;;;;;;OAOG;IACH;gBAFqB,EAAE;mBAAa,EAAE;MA2DrC;IAED;;;;;OAKG;IACH,eAFY,MAAM,CAmEjB;IAGL;;;OAGG;IACH,wBAFU,OAAO,CAEkB;CANlC;8BAzjB6B,oBAAoB;6BACrB,mBAAmB;kCAJd,wBAAwB"}
1
+ {"version":3,"file":"RenderGraph.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/RenderGraph.js"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH;IA6BI;;;OAGG;IACH,mBAFW,MAAM,EAOhB;IArCD;;;;OAIG;IACH,MAFU,MAAM,CAEN;IAEV;;;;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;;;;;OAKG;IACH,2BAJW,MAAM,oBAEJ,MAAM,CAWlB;IAED;;;;;OAKG;IACH,6BAYC;IAED;;;;;;OAMG;IACH,4BAeC;IAED;;;;OAIG;IACH,wBAHW,MAAM,GACJ,MAAM,CAkBlB;IAED;;;;;;OAMG;IACH,2BALW,MAAM,wDAGJ,MAAM,CAUlB;IAED;;;OAGG;IACH,4BAHa,OAAO,CAQnB;IAED;;;;;;;OAOG;IACH,eALW,MAAM,4BAGJ,iBAAiB,CA2B7B;IAED;;;;;;OAMG;IACH,iEAFa,OAAO,CAQnB;IAED,gBA6FC;IAED;;;OAGG;IACH,uCA2CC;IAED;;;;;;;OAOG;IACH;gBAFqB,EAAE;mBAAa,EAAE;MA2DrC;IAED;;;;;OAKG;IACH,eAFY,MAAM,CA0FjB;IAGL;;;OAGG;IACH,wBAFU,OAAO,CAEkB;CANlC;8BAhlB6B,oBAAoB;6BACrB,mBAAmB;kCAJd,wBAAwB"}
@@ -1,6 +1,11 @@
1
1
  import { assert } from "../../../../core/assert.js";
2
+ import { float_to_uint8 } from "../../../../core/binary/float_to_uint8.js";
2
3
  import LineBuilder from "../../../../core/codegen/LineBuilder.js";
4
+ import { rgb2hex } from "../../../../core/color/hex/rgb2hex.js";
5
+ import { okhsv_to_linear_srgb } from "../../../../core/color/oklab/okhsv_to_linear_srgb.js";
3
6
  import { graphviz_escape_string } from "../../../../core/graph/format/graphviz/graphviz_escape_string.js";
7
+ import { lerp } from "../../../../core/math/lerp.js";
8
+ import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
4
9
  import { RenderPassBuilder } from "./RenderPassBuilder.js";
5
10
  import { RenderPassNode } from "./RenderPassNode.js";
6
11
  import { RenderPassResources } from "./RenderPassResources.js";
@@ -526,6 +531,20 @@ export class RenderGraph {
526
531
 
527
532
  // -- Define resource nodes
528
533
 
534
+ /**
535
+ *
536
+ * @param {string} type
537
+ */
538
+ function type_to_color(type) {
539
+
540
+ const hash = computeStringHash(type);
541
+
542
+ const hue = (hash & 0xffff) / 0xffff;
543
+ const value = (hash >>> 16) / 0xffff;
544
+
545
+ return [hue, value];
546
+ }
547
+
529
548
  out.add("");
530
549
  out.add("# Resource Nodes");
531
550
  for (const node of this.__resource_nodes) {
@@ -533,7 +552,16 @@ export class RenderGraph {
533
552
 
534
553
  const content = graphviz_escape_string(entry.toString());
535
554
 
536
- out.add(`R${entry.resource_id}_${node.version} [label=<{ {<B>${node.name}</B>${node.version > 0 ? ` <FONT>v${node.version}</FONT>` : ""}<BR/>${content}} | {Index: ${entry.resource_id}<BR/> Refs : ${node.ref_count} } }> style=filled, fillcolor=${entry.isImported() ? "lightsteelblue" : "skyblue"}]`);
555
+ const [color_hue, color_value] = type_to_color(entry.resource_descriptor?.type ?? "");
556
+
557
+ const saturation = entry.isImported() ? 0.9 : 0.5;
558
+
559
+ const color_rgb = [];
560
+ okhsv_to_linear_srgb(color_rgb, color_hue, saturation, lerp(0.5, 0.7, color_value))
561
+
562
+ const hex = rgb2hex(...color_rgb.map(float_to_uint8));
563
+
564
+ out.add(`R${entry.resource_id}_${node.version} [label=<{ {<B>${node.name}</B>${node.version > 0 ? ` <FONT>v${node.version}</FONT>` : ""}<BR/>${content}} | {Index: ${entry.resource_id}<BR/> Refs : ${node.ref_count} } }> style=filled, fillcolor=#${hex}]`);
537
565
  }
538
566
 
539
567
  // -- Each pass node points to the resource that it writes