@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.cjs.js +58 -58
- package/dist/hermes.es.js +78 -79
- package/package.json +1 -1
- package/types/utils/post.d.ts +1 -1
- package/types/utils/three.d.ts +1 -1
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 || (
|
|
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
|
|
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
|
|
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
|
|
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
|
|
709
|
-
|
|
705
|
+
const s = [];
|
|
706
|
+
s.push({
|
|
710
707
|
type: "boolean",
|
|
711
708
|
prop: "Enabled",
|
|
712
709
|
value: a.enabled
|
|
713
710
|
});
|
|
714
|
-
let
|
|
715
|
-
console.log("Default Handle Pass:",
|
|
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((
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
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 (
|
|
733
|
-
const
|
|
734
|
-
|
|
735
|
-
prop:
|
|
736
|
-
title:
|
|
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: [
|
|
740
|
-
repeat: [
|
|
741
|
-
src:
|
|
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
|
|
745
|
-
prop:
|
|
746
|
-
title:
|
|
742
|
+
} else typeof o.value == "number" ? s.push({
|
|
743
|
+
prop: l,
|
|
744
|
+
title: c,
|
|
747
745
|
type: "number",
|
|
748
|
-
value:
|
|
746
|
+
value: o.value,
|
|
749
747
|
step: 0.01
|
|
750
|
-
}) : typeof
|
|
751
|
-
prop:
|
|
752
|
-
title:
|
|
748
|
+
}) : typeof o.value == "string" ? s.push({
|
|
749
|
+
prop: l,
|
|
750
|
+
title: c,
|
|
753
751
|
type: "string",
|
|
754
|
-
value:
|
|
755
|
-
}) : typeof
|
|
756
|
-
prop:
|
|
757
|
-
title:
|
|
752
|
+
value: o.value
|
|
753
|
+
}) : typeof o.value == "boolean" && s.push({
|
|
754
|
+
prop: l,
|
|
755
|
+
title: c,
|
|
758
756
|
type: "boolean",
|
|
759
|
-
value:
|
|
757
|
+
value: o.value
|
|
760
758
|
});
|
|
761
759
|
});
|
|
762
|
-
}),
|
|
763
|
-
a.effects.forEach((
|
|
764
|
-
|
|
765
|
-
|
|
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
|
|
771
|
-
for (const
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
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 (
|
|
785
|
-
const
|
|
786
|
-
|
|
787
|
-
title:
|
|
788
|
-
prop:
|
|
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: [
|
|
792
|
-
repeat: [
|
|
793
|
-
src:
|
|
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
|
|
797
|
-
title:
|
|
798
|
-
prop:
|
|
795
|
+
} else typeof l.value == "number" ? s.push({
|
|
796
|
+
title: c,
|
|
797
|
+
prop: o,
|
|
799
798
|
type: "number",
|
|
800
|
-
value:
|
|
799
|
+
value: l.value,
|
|
801
800
|
step: 0.01
|
|
802
|
-
}) : typeof
|
|
803
|
-
title:
|
|
804
|
-
prop:
|
|
801
|
+
}) : typeof l.value == "string" ? s.push({
|
|
802
|
+
title: c,
|
|
803
|
+
prop: o,
|
|
805
804
|
type: "string",
|
|
806
|
-
value:
|
|
807
|
-
}) : typeof
|
|
808
|
-
title:
|
|
809
|
-
prop:
|
|
805
|
+
value: l.value
|
|
806
|
+
}) : typeof l.value == "boolean" && s.push({
|
|
807
|
+
title: c,
|
|
808
|
+
prop: o,
|
|
810
809
|
type: "boolean",
|
|
811
|
-
value:
|
|
810
|
+
value: l.value
|
|
812
811
|
});
|
|
813
812
|
}
|
|
814
|
-
|
|
815
|
-
const
|
|
816
|
-
|
|
813
|
+
i = (o, l) => {
|
|
814
|
+
const c = r.uniforms[o];
|
|
815
|
+
c.value = l;
|
|
817
816
|
};
|
|
818
817
|
} else
|
|
819
818
|
return;
|
|
820
|
-
const
|
|
819
|
+
const n = `${a.name}: ${a.scene.name}`;
|
|
821
820
|
e.addGroup({
|
|
822
|
-
title:
|
|
823
|
-
items:
|
|
824
|
-
onUpdate: (
|
|
825
|
-
|
|
821
|
+
title: n,
|
|
822
|
+
items: s,
|
|
823
|
+
onUpdate: (r, o) => {
|
|
824
|
+
r === "Enabled" ? a.enabled = o : i(r, o);
|
|
826
825
|
}
|
|
827
|
-
}), Lh.push(
|
|
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.
|
|
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"
|
package/types/utils/post.d.ts
CHANGED
|
@@ -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>;
|
package/types/utils/three.d.ts
CHANGED
|
@@ -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
|
|
20
|
+
static renderToBlob(texture: Texture): string;
|
|
21
21
|
private static renderToCanvas;
|
|
22
22
|
}
|
|
23
23
|
export type ParsedModel = {
|