@tomorrowevening/hermes 0.1.8 → 0.1.9

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/dist/hermes.es.js CHANGED
@@ -644,7 +644,7 @@ class xn {
644
644
  static width = 100;
645
645
  static height = 100;
646
646
  static init() {
647
- this.inited || (typeof document < "u" ? this.canvas = document.createElement("canvas") : this.canvas = new OffscreenCanvas(this.width, this.height), this.canvas.width = this.width, this.canvas.height = this.height, this.context = this.canvas.getContext("2d"), this.inited = !0);
647
+ this.inited || (this.canvas = document.createElement("canvas"), this.canvas.width = this.width, this.canvas.height = this.height, this.context = this.canvas.getContext("2d"), this.inited = !0);
648
648
  }
649
649
  static renderToBlob(e) {
650
650
  this.init();
@@ -653,15 +653,12 @@ class xn {
653
653
  this.context.clearRect(0, 0, this.width, this.height);
654
654
  const i = e.image;
655
655
  if (i != null && i.width > 0) {
656
- this.canvas instanceof HTMLCanvasElement && (this.canvas.title = e.sourceFile);
656
+ this.canvas.title = e.sourceFile;
657
657
  const n = this.canvas.width / i.width, r = this.renderToCanvas(e);
658
658
  this.context.drawImage(r, 0, 0, i.width * n, i.height * n);
659
659
  }
660
660
  }
661
- return e.repeat.copy(t), e.offset.copy(s), this.canvas instanceof HTMLCanvasElement ? this.canvas.toDataURL("image/png") : this.canvas.convertToBlob({ type: "image/png" }).then((i) => new Promise((n) => {
662
- const r = new FileReader();
663
- r.onload = () => n(r.result), r.readAsDataURL(i);
664
- }));
661
+ return e.repeat.copy(t), e.offset.copy(s), this.canvas.toDataURL("image/png");
665
662
  }
666
663
  static renderToCanvas(e) {
667
664
  if (this.material === null) {
@@ -677,7 +674,7 @@ class xn {
677
674
  const t = this.renderer.outputColorSpace, s = e.colorSpace;
678
675
  this.renderer.outputColorSpace = Fa, e.colorSpace = Fa, this.material.map = e, this.renderer.render(this.scene, this.camera), this.renderer.outputColorSpace = t, e.colorSpace = s;
679
676
  }
680
- return this.renderer.domElement instanceof HTMLCanvasElement ? this.renderer.domElement : this.canvas;
677
+ return this.renderer.domElement;
681
678
  }
682
679
  }
683
680
  function _P(a) {
@@ -703,25 +700,26 @@ function _P(a) {
703
700
  });
704
701
  }
705
702
  let Lh = [];
706
- function y_(a, e) {
703
+ function y_(a, e, t = !0) {
707
704
  xn.renderer = e.renderer;
708
- const t = [];
709
- t.push({
705
+ const s = [];
706
+ s.push({
710
707
  type: "boolean",
711
708
  prop: "Enabled",
712
709
  value: a.enabled
713
710
  });
714
- let s = (n, r) => {
715
- console.log("Default Handle Pass:", n, r);
711
+ let i = (r, o) => {
712
+ console.log("Default Handle Pass:", r, o);
716
713
  };
717
714
  if (a.name === "EffectPass")
718
- a.effects.forEach((n) => {
719
- n.uniforms.size > 0 && n.uniforms.forEach((r, o) => {
720
- const l = `${n.name.replace("Effect", "")} ${o}`;
721
- if (r.value === null)
722
- t.push({
723
- prop: o,
724
- title: l,
715
+ a.effects.forEach((r) => {
716
+ r.uniforms.size > 0 && r.uniforms.forEach((o, l) => {
717
+ if (l === "map") return;
718
+ const c = `${r.name.replace("Effect", "")} ${l}`;
719
+ if (o.value === null && t)
720
+ s.push({
721
+ prop: l,
722
+ title: c,
725
723
  type: "image",
726
724
  value: {
727
725
  offset: [0, 0],
@@ -729,51 +727,52 @@ function y_(a, e) {
729
727
  src: ""
730
728
  }
731
729
  });
732
- else if (r.value.isTexture) {
733
- const c = r.value, h = xn.renderToBlob(c);
734
- t.push({
735
- prop: o,
736
- title: l,
730
+ else if (o.value.isTexture && t) {
731
+ const h = o.value, u = xn.renderToBlob(h);
732
+ s.push({
733
+ prop: l,
734
+ title: c,
737
735
  type: "image",
738
736
  value: {
739
- offset: [c.offset.x, c.offset.y],
740
- repeat: [c.repeat.x, c.repeat.y],
741
- src: h
737
+ offset: [h.offset.x, h.offset.y],
738
+ repeat: [h.repeat.x, h.repeat.y],
739
+ src: u
742
740
  }
743
741
  });
744
- } else typeof r.value == "number" ? t.push({
745
- prop: o,
746
- title: l,
742
+ } else typeof o.value == "number" ? s.push({
743
+ prop: l,
744
+ title: c,
747
745
  type: "number",
748
- value: r.value,
746
+ value: o.value,
749
747
  step: 0.01
750
- }) : typeof r.value == "string" ? t.push({
751
- prop: o,
752
- title: l,
748
+ }) : typeof o.value == "string" ? s.push({
749
+ prop: l,
750
+ title: c,
753
751
  type: "string",
754
- value: r.value
755
- }) : typeof r.value == "boolean" && t.push({
756
- prop: o,
757
- title: l,
752
+ value: o.value
753
+ }) : typeof o.value == "boolean" && s.push({
754
+ prop: l,
755
+ title: c,
758
756
  type: "boolean",
759
- value: r.value
757
+ value: o.value
760
758
  });
761
759
  });
762
- }), s = (n, r) => {
763
- a.effects.forEach((o) => {
764
- o.uniforms.size > 0 && o.uniforms.forEach((l, c) => {
765
- c === n && (l.value = r);
760
+ }), i = (r, o) => {
761
+ a.effects.forEach((l) => {
762
+ l.uniforms.size > 0 && l.uniforms.forEach((c, h) => {
763
+ h === r && (c.value = o);
766
764
  });
767
765
  });
768
766
  };
769
767
  else if (a.name === "ShaderPass") {
770
- const n = a.fullscreenMaterial;
771
- for (const r in n.uniforms) {
772
- const o = n.uniforms[r], l = `${n.name.replace("Material", "")} ${r}`;
773
- if (o.value === null)
774
- t.push({
775
- title: l,
776
- prop: r,
768
+ const r = a.fullscreenMaterial;
769
+ for (const o in r.uniforms) {
770
+ if (o === "inputBuffer" || o === "map") continue;
771
+ const l = r.uniforms[o], c = `${r.name.replace("Material", "")} ${o}`;
772
+ if (l.value === null && t)
773
+ s.push({
774
+ title: c,
775
+ prop: o,
777
776
  type: "image",
778
777
  value: {
779
778
  offset: [0, 0],
@@ -781,50 +780,50 @@ function y_(a, e) {
781
780
  src: ""
782
781
  }
783
782
  });
784
- else if (o.value.isTexture) {
785
- const c = o.value, h = xn.renderToBlob(c);
786
- t.push({
787
- title: l,
788
- prop: r,
783
+ else if (l.value.isTexture && t) {
784
+ const h = l.value, u = xn.renderToBlob(h);
785
+ s.push({
786
+ title: c,
787
+ prop: o,
789
788
  type: "image",
790
789
  value: {
791
- offset: [c.offset.x, c.offset.y],
792
- repeat: [c.repeat.x, c.repeat.y],
793
- src: h
790
+ offset: [h.offset.x, h.offset.y],
791
+ repeat: [h.repeat.x, h.repeat.y],
792
+ src: u
794
793
  }
795
794
  });
796
- } else typeof o.value == "number" ? t.push({
797
- title: l,
798
- prop: r,
795
+ } else typeof l.value == "number" ? s.push({
796
+ title: c,
797
+ prop: o,
799
798
  type: "number",
800
- value: o.value,
799
+ value: l.value,
801
800
  step: 0.01
802
- }) : typeof o.value == "string" ? t.push({
803
- title: l,
804
- prop: r,
801
+ }) : typeof l.value == "string" ? s.push({
802
+ title: c,
803
+ prop: o,
805
804
  type: "string",
806
- value: o.value
807
- }) : typeof o.value == "boolean" && t.push({
808
- title: l,
809
- prop: r,
805
+ value: l.value
806
+ }) : typeof l.value == "boolean" && s.push({
807
+ title: c,
808
+ prop: o,
810
809
  type: "boolean",
811
- value: o.value
810
+ value: l.value
812
811
  });
813
812
  }
814
- s = (r, o) => {
815
- const l = n.uniforms[r];
816
- l.value = o;
813
+ i = (o, l) => {
814
+ const c = r.uniforms[o];
815
+ c.value = l;
817
816
  };
818
817
  } else
819
818
  return;
820
- const i = `${a.name}: ${a.scene.name}`;
819
+ const n = `${a.name}: ${a.scene.name}`;
821
820
  e.addGroup({
822
- title: i,
823
- items: t,
824
- onUpdate: (n, r) => {
825
- n === "Enabled" ? a.enabled = r : s(n, r);
821
+ title: n,
822
+ items: s,
823
+ onUpdate: (r, o) => {
824
+ r === "Enabled" ? a.enabled = o : i(r, o);
826
825
  }
827
- }), Lh.push(i);
826
+ }), Lh.push(n);
828
827
  }
829
828
  function bP(a, e) {
830
829
  a.passes.forEach((t) => {
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "module": "./dist/hermes.esm.js",
8
8
  "types": "./types/index.d.ts",
9
9
  "type": "module",
10
- "version": "0.1.8",
10
+ "version": "0.1.9",
11
11
  "homepage": "https://github.com/tomorrowevening/hermes#readme",
12
12
  "bugs": {
13
13
  "url": "https://github.com/tomorrowevening/hermes/issues"
@@ -1,6 +1,6 @@
1
1
  import { PerspectiveCamera, WebGLRenderer } from 'three';
2
2
  import RemoteThree from '../core/remote/RemoteThree';
3
- export declare function inspectComposerPass(pass: any, three: RemoteThree): void;
3
+ export declare function inspectComposerPass(pass: any, three: RemoteThree, includeTextures?: boolean): void;
4
4
  export declare function inspectComposer(composer: any, three: RemoteThree): void;
5
5
  export declare function clearComposerGroups(three: RemoteThree): void;
6
6
  export declare function generateCubemap(renderer: WebGLRenderer, camera: PerspectiveCamera, composer: any, size?: number): Promise<void>;
@@ -17,7 +17,7 @@ export declare class ExportTexture {
17
17
  private static width;
18
18
  private static height;
19
19
  private static init;
20
- static renderToBlob(texture: Texture): string | Promise<string>;
20
+ static renderToBlob(texture: Texture): string;
21
21
  private static renderToCanvas;
22
22
  }
23
23
  export type ParsedModel = {