@tomorrowevening/hermes 0.1.39 → 0.1.40

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.
Files changed (66) hide show
  1. package/dist/{ThreeEditor-CTkjs-SY.js → ThreeEditor-CB5dBR7Q.js} +1 -1
  2. package/dist/core/Application.js +77 -0
  3. package/dist/core/remote/BaseRemote.js +33 -0
  4. package/dist/core/remote/RemoteTheatre.js +253 -0
  5. package/dist/core/remote/RemoteThree.js +442 -0
  6. package/dist/core/types.js +7 -0
  7. package/dist/editor/Editor.js +12 -0
  8. package/dist/editor/HermesApp.js +24 -0
  9. package/dist/editor/ThreeEditor.js +22 -0
  10. package/dist/editor/components/Draggable.js +40 -0
  11. package/dist/editor/components/DraggableItem.js +25 -0
  12. package/dist/editor/components/Dropdown.js +32 -0
  13. package/dist/editor/components/DropdownItem.js +50 -0
  14. package/dist/editor/components/NavButton.js +7 -0
  15. package/dist/editor/components/content.js +4 -0
  16. package/dist/editor/components/icons/CloseIcon.js +9 -0
  17. package/dist/editor/components/icons/DragIcon.js +12 -0
  18. package/dist/editor/multiView/CameraWindow.js +64 -0
  19. package/dist/editor/multiView/DepthNodeMaterial.js +12 -0
  20. package/dist/editor/multiView/InfiniteGridHelper.js +31 -0
  21. package/dist/editor/multiView/InfiniteGridHelperGPU.js +31 -0
  22. package/dist/editor/multiView/InfiniteGridMaterial.js +137 -0
  23. package/dist/editor/multiView/InfiniteGridNodeMaterial.js +63 -0
  24. package/dist/editor/multiView/MultiView.js +890 -0
  25. package/dist/editor/multiView/Toggle.js +25 -0
  26. package/dist/editor/multiView/UVMaterial.js +60 -0
  27. package/dist/editor/multiView/UVNodeMaterial.js +10 -0
  28. package/dist/editor/sidePanel/Accordion.js +56 -0
  29. package/dist/editor/sidePanel/ChildObject.js +78 -0
  30. package/dist/editor/sidePanel/ContainerObject.js +11 -0
  31. package/dist/editor/sidePanel/DebugData.js +133 -0
  32. package/dist/editor/sidePanel/SidePanel.js +91 -0
  33. package/dist/editor/sidePanel/inspector/InspectGrid3.js +82 -0
  34. package/dist/editor/sidePanel/inspector/InspectGrid4.js +58 -0
  35. package/dist/editor/sidePanel/inspector/InspectImage.js +100 -0
  36. package/dist/editor/sidePanel/inspector/InspectNumber.js +76 -0
  37. package/dist/editor/sidePanel/inspector/InspectVector2.js +154 -0
  38. package/dist/editor/sidePanel/inspector/Inspector.js +95 -0
  39. package/dist/editor/sidePanel/inspector/InspectorField.js +128 -0
  40. package/dist/editor/sidePanel/inspector/InspectorGroup.js +110 -0
  41. package/dist/editor/sidePanel/inspector/utils/DragNumber.js +27 -0
  42. package/dist/editor/sidePanel/inspector/utils/InspectAnimation.js +99 -0
  43. package/dist/editor/sidePanel/inspector/utils/InspectCamera.js +91 -0
  44. package/dist/editor/sidePanel/inspector/utils/InspectLight.js +85 -0
  45. package/dist/editor/sidePanel/inspector/utils/InspectMaterial.js +861 -0
  46. package/dist/editor/sidePanel/inspector/utils/InspectTransform.js +93 -0
  47. package/dist/editor/sidePanel/utils.js +259 -0
  48. package/dist/editor/tools/Transform.js +77 -0
  49. package/dist/editor/tools/splineEditor/Spline.js +348 -0
  50. package/dist/editor/tools/splineEditor/index.js +193 -0
  51. package/dist/editor/utils.js +27 -0
  52. package/dist/hermes.cjs.js +8 -30
  53. package/dist/{index-BpKOzCuX.js → index-DepTXu6T.js} +454 -454
  54. package/dist/index.html +1 -1
  55. package/dist/index.js +125 -0
  56. package/dist/utils/ImageSequenceCapturer.js +148 -0
  57. package/dist/utils/detectSettings.js +46 -0
  58. package/dist/utils/math.js +68 -0
  59. package/dist/utils/post.js +206 -0
  60. package/dist/utils/theatre.js +316 -0
  61. package/dist/utils/three.js +199 -0
  62. package/dist/webworkers/EventHandling.js +115 -0
  63. package/dist/webworkers/ProxyManager.js +76 -0
  64. package/package.json +13 -7
  65. package/dist/.vite/manifest.json +0 -12
  66. package/dist/hermes.es.js +0 -8077
@@ -0,0 +1,12 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ const o = /* @__PURE__ */ r("svg", { className: "dragIcon", width: "14", height: "14", fill: "#666666", stroke: "none", children: /* @__PURE__ */ r(
3
+ "path",
4
+ {
5
+ d: `M10.43,4H3.57C3.26,4,3,4.22,3,4.5v1C3,5.78,3.26,6,3.57,6h6.86C10.74,6,11,5.78,11,5.5v-1\r
6
+ C11,4.22,10.74,4,10.43,4z M10.43,8H3.57C3.26,8,3,8.22,3,8.5v1C3,9.78,3.26,10,3.57,10h6.86C10.74,10,11,9.78,11,9.5v-1\r
7
+ C11,8.22,10.74,8,10.43,8z`
8
+ }
9
+ ) });
10
+ export {
11
+ o as default
12
+ };
@@ -0,0 +1,64 @@
1
+ import { jsxs as f, jsx as d } from "react/jsx-runtime";
2
+ import { forwardRef as w, useState as l } from "react";
3
+ const x = (e) => {
4
+ const [n, c] = l(e.options[e.index]), i = () => {
5
+ e.onToggle(!e.open);
6
+ }, a = (t) => {
7
+ t !== n && (e.onSelect(t), c(t)), e.onToggle(!1);
8
+ }, s = e.open ? `${e.options.length * 31 - 1}px` : "0px";
9
+ return /* @__PURE__ */ f("div", { className: `dropdown ${e.up === !0 ? "up" : ""}`, children: [
10
+ /* @__PURE__ */ d("div", { className: "dropdown-toggle", onClick: i, children: `${e.title}: ${n}` }),
11
+ /* @__PURE__ */ d("ul", { className: "dropdown-menu", style: { height: s }, children: e.options.map((t) => /* @__PURE__ */ d("li", { onClick: () => a(t), children: t }, t)) })
12
+ ] });
13
+ }, R = w(function(n, c) {
14
+ const i = [
15
+ "Renderer",
16
+ "Depth",
17
+ "Normals",
18
+ "UVs",
19
+ "Wireframe"
20
+ ], [a, s] = l("Renderer"), [t, O] = l(!1), [u, g] = l(!1), [r, m] = l(!1);
21
+ return /* @__PURE__ */ f("div", { className: `CameraWindow ${n.name}`, children: [
22
+ /* @__PURE__ */ d("div", { ref: c, className: "clickable", onClick: () => {
23
+ r && m(!1);
24
+ } }),
25
+ /* @__PURE__ */ f("div", { className: "options", children: [
26
+ n.camera !== null && /* @__PURE__ */ d(
27
+ x,
28
+ {
29
+ title: "Camera",
30
+ index: n.options.indexOf(n.camera.name),
31
+ open: r,
32
+ options: n.options,
33
+ onSelect: n.onSelectCamera,
34
+ onToggle: (o) => {
35
+ o && u && g(!1), m(o);
36
+ },
37
+ up: !0
38
+ }
39
+ ),
40
+ /* @__PURE__ */ d(
41
+ x,
42
+ {
43
+ title: "Mode",
44
+ index: i.indexOf(a),
45
+ open: u,
46
+ options: i,
47
+ onSelect: (o) => {
48
+ if (o === a) return;
49
+ const h = o;
50
+ n.onSelectRenderMode(h), s(h);
51
+ },
52
+ onToggle: (o) => {
53
+ o && r && m(!1), t && O(!1), g(o);
54
+ },
55
+ up: !0
56
+ }
57
+ )
58
+ ] })
59
+ ] });
60
+ });
61
+ export {
62
+ x as Dropdown,
63
+ R as default
64
+ };
@@ -0,0 +1,12 @@
1
+ import o from "three/src/materials/nodes/MeshBasicNodeMaterial.js";
2
+ import { remapClamp as r, linearDepth as t, vec4 as a } from "three/src/nodes/TSL.js";
3
+ class c extends o {
4
+ constructor() {
5
+ super();
6
+ const e = r(t(), 0.1, 0.5, 0, 1).oneMinus();
7
+ this.colorNode = a(e, e, e, 1);
8
+ }
9
+ }
10
+ export {
11
+ c as default
12
+ };
@@ -0,0 +1,31 @@
1
+ import { Mesh as t, PlaneGeometry as e } from "three";
2
+ import a from "./InfiniteGridMaterial.js";
3
+ class g extends t {
4
+ gridMaterial;
5
+ constructor(i) {
6
+ const r = new a(i);
7
+ super(new e(), r), this.gridMaterial = r, this.frustumCulled = !1, this.name = "InfiniteGridHelper";
8
+ }
9
+ // Getters / Setters
10
+ get color() {
11
+ return this.gridMaterial.color;
12
+ }
13
+ set color(i) {
14
+ this.gridMaterial.color = i;
15
+ }
16
+ get gridOpacity() {
17
+ return this.gridMaterial.gridOpacity;
18
+ }
19
+ set gridOpacity(i) {
20
+ this.gridMaterial.gridOpacity = i;
21
+ }
22
+ get subgridOpacity() {
23
+ return this.gridMaterial.subgridOpacity;
24
+ }
25
+ set subgridOpacity(i) {
26
+ this.gridMaterial.subgridOpacity = i;
27
+ }
28
+ }
29
+ export {
30
+ g as default
31
+ };
@@ -0,0 +1,31 @@
1
+ import { Mesh as t, PlaneGeometry as e } from "three/webgpu";
2
+ import a from "./InfiniteGridNodeMaterial.js";
3
+ class g extends t {
4
+ gridMaterial;
5
+ constructor(i) {
6
+ const r = new a(i);
7
+ super(new e(), r), this.gridMaterial = r, this.frustumCulled = !1, this.name = "InfiniteGridHelper";
8
+ }
9
+ // Getters / Setters
10
+ get color() {
11
+ return this.gridMaterial.color;
12
+ }
13
+ set color(i) {
14
+ this.gridMaterial.color = i;
15
+ }
16
+ get gridOpacity() {
17
+ return this.gridMaterial.gridOpacity;
18
+ }
19
+ set gridOpacity(i) {
20
+ this.gridMaterial.gridOpacity = i;
21
+ }
22
+ get subgridOpacity() {
23
+ return this.gridMaterial.subgridOpacity;
24
+ }
25
+ set subgridOpacity(i) {
26
+ this.gridMaterial.subgridOpacity = i;
27
+ }
28
+ }
29
+ export {
30
+ g as default
31
+ };
@@ -0,0 +1,137 @@
1
+ import { ShaderMaterial as i, DoubleSide as t, GLSL3 as a, Color as o } from "three";
2
+ const r = `out vec3 worldPosition;
3
+ uniform float uDistance;
4
+
5
+ void main() {
6
+ // Scale the plane by the drawing distance
7
+ worldPosition = position.xzy * uDistance;
8
+ worldPosition.xz += cameraPosition.xz;
9
+
10
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(worldPosition, 1.0);
11
+ }`, n = `out vec4 fragColor;
12
+ in vec3 worldPosition;
13
+ uniform float uDivisions;
14
+ uniform float uScale;
15
+ uniform vec3 uColor;
16
+ uniform float uDistance;
17
+ uniform float uGridOpacity;
18
+ uniform float uSubgridOpacity;
19
+
20
+ #define minAlpha 0.00784313725490196
21
+
22
+ float getGrid(float gapSize) {
23
+ vec2 worldPositionByDivision = worldPosition.xz / gapSize;
24
+
25
+ // Inverted, 0 where line, >1 where there's no line
26
+ // We use the worldPosition (which in this case we use similarly to UVs) differential to control the anti-aliasing
27
+ // We need to do the -0.5)-0.5 trick because the result fades out from 0 to 1, and we want both
28
+ // worldPositionByDivision == 0.3 and worldPositionByDivision == 0.7 to result in the same fade, i.e. 0.3,
29
+ // otherwise only one side of the line will be anti-aliased
30
+ vec2 grid = abs(fract(worldPositionByDivision-0.5)-0.5) / fwidth(worldPositionByDivision) / 2.0;
31
+ float gridLine = min(grid.x, grid.y);
32
+
33
+ // Uninvert and clamp
34
+ return 1.0 - min(gridLine, 1.0);
35
+ }
36
+
37
+ void main() {
38
+ float cameraDistanceToGridPlane = max(200.0, distance(cameraPosition.y, worldPosition.y));
39
+ float cameraDistanceToFragmentOnGridPlane = distance(cameraPosition.xyz, worldPosition.xyz);
40
+
41
+ // The size of the grid and subgrid are powers of each other and they are determined based on camera distance.
42
+ // The current grid will become the next subgrid when it becomes too small, and its next power becomes the new grid.
43
+ float subGridPower = pow(uDivisions, floor(log(cameraDistanceToGridPlane) / log(uDivisions)));
44
+ float gridPower = subGridPower * uDivisions;
45
+
46
+ // If we want to fade both the grid and its subgrid, we need to displays 3 different opacities, with the next grid being the third
47
+ float nextGridPower = gridPower * uDivisions;
48
+
49
+ // 1 where grid, 0 where no grid
50
+ float subgrid = getGrid(subGridPower * uScale);
51
+ float grid = getGrid(gridPower * uScale);
52
+ float nextGrid = getGrid(nextGridPower * uScale);
53
+
54
+ // Where we are between the introduction of the current grid power and when we switch to the next grid power
55
+ float stepPercentage = (cameraDistanceToGridPlane - subGridPower)/(gridPower - subGridPower);
56
+
57
+ // The last x percentage of the current step over which we want to fade
58
+ float fadeRange = 0.3;
59
+
60
+ // We calculate the fade percentage from the step percentage and the fade range
61
+ float fadePercentage = max(stepPercentage - 1.0 + fadeRange, 0.0) / fadeRange;
62
+
63
+ // Set base opacity based on how close we are to the drawing distance, with a cubic falloff
64
+ float baseOpacity = subgrid * pow(1.0 - min(cameraDistanceToFragmentOnGridPlane / uDistance, 1.0), 3.0);
65
+
66
+ // Shade the subgrid
67
+ fragColor = vec4(uColor.rgb, (baseOpacity - fadePercentage) * uSubgridOpacity);
68
+
69
+ // Somewhat arbitrary additional fade coefficient to counter anti-aliasing popping when switching between grid powers
70
+ float fadeCoefficient = 0.5;
71
+
72
+ // Shade the grid
73
+ fragColor.a = mix(fragColor.a, baseOpacity * uGridOpacity - fadePercentage * (uGridOpacity - uSubgridOpacity) * fadeCoefficient, grid);
74
+
75
+ // Shade the next grid
76
+ fragColor.a = mix(fragColor.a, baseOpacity * uGridOpacity, nextGrid);
77
+
78
+ if (fragColor.a <= minAlpha) discard;
79
+ }`;
80
+ class l extends i {
81
+ constructor(e) {
82
+ super({
83
+ extensions: {
84
+ // @ts-ignore
85
+ derivatives: !0
86
+ },
87
+ uniforms: {
88
+ uScale: {
89
+ value: e?.scale !== void 0 ? e?.scale : 0.1
90
+ },
91
+ uDivisions: {
92
+ value: e?.divisions !== void 0 ? e?.divisions : 10
93
+ },
94
+ uColor: {
95
+ value: e?.color !== void 0 ? e?.color : new o(16777215)
96
+ },
97
+ uDistance: {
98
+ value: e?.distance !== void 0 ? e?.distance : 1e4
99
+ },
100
+ uSubgridOpacity: {
101
+ value: e?.subgridOpacity !== void 0 ? e?.subgridOpacity : 0.15
102
+ },
103
+ uGridOpacity: {
104
+ value: e?.gridOpacity !== void 0 ? e?.gridOpacity : 0.25
105
+ }
106
+ },
107
+ glslVersion: a,
108
+ side: t,
109
+ transparent: !0,
110
+ name: "InfiniteGrid",
111
+ vertexShader: r,
112
+ fragmentShader: n
113
+ });
114
+ }
115
+ // Getters / Setters
116
+ get color() {
117
+ return this.uniforms.uColor.value;
118
+ }
119
+ set color(e) {
120
+ this.uniforms.uColor.value = e;
121
+ }
122
+ get gridOpacity() {
123
+ return this.uniforms.uGridOpacity.value;
124
+ }
125
+ set gridOpacity(e) {
126
+ this.uniforms.uGridOpacity.value = e;
127
+ }
128
+ get subgridOpacity() {
129
+ return this.uniforms.uSubgridOpacity.value;
130
+ }
131
+ set subgridOpacity(e) {
132
+ this.uniforms.uSubgridOpacity.value = e;
133
+ }
134
+ }
135
+ export {
136
+ l as default
137
+ };
@@ -0,0 +1,63 @@
1
+ import { NodeMaterial as q, DoubleSide as E, Color as j } from "three/webgpu";
2
+ import { uniform as u, varyingProperty as k, Fn as v, positionLocal as A, vec3 as B, cameraPosition as n, float as i, fwidth as H, abs as x, fract as J, min as h, max as D, distance as K, log as P, pow as S, floor as Q, mix as C, If as U, lessThanEqual as V, Discard as X, vec4 as Y } from "three/tsl";
3
+ class ii extends q {
4
+ uScale;
5
+ uDivisions;
6
+ uColor;
7
+ uDistance;
8
+ uSubgridOpacity;
9
+ uGridOpacity;
10
+ constructor(t) {
11
+ super(), this.name = "InfiniteGrid", this.side = E, this.transparent = !0, this.uScale = u(t?.scale ?? 0.1), this.uDivisions = u(t?.divisions ?? 10), this.uColor = u(t?.color ?? new j(16777215)), this.uDistance = u(t?.distance ?? 1e4), this.uSubgridOpacity = u(t?.subgridOpacity ?? 0.15), this.uGridOpacity = u(t?.gridOpacity ?? 0.25);
12
+ const { uScale: c, uDivisions: a, uColor: N, uDistance: y, uSubgridOpacity: f, uGridOpacity: d } = this, l = k("vec3", "vWorldPosition");
13
+ this.positionNode = v(() => {
14
+ const s = A.xzy.mul(y).add(
15
+ B(n.x, i(0), n.z)
16
+ );
17
+ return l.assign(s), s;
18
+ })();
19
+ const g = v(([s]) => {
20
+ const e = l.xz.div(s), b = H(e), r = x(J(e.sub(0.5)).sub(0.5)).div(b).div(2), o = h(r.x, r.y);
21
+ return i(1).sub(h(o, i(1)));
22
+ });
23
+ this.outputNode = v(() => {
24
+ const s = l, e = D(i(200), x(n.y.sub(s.y))), b = i(K(n, s)), r = P(e).div(P(a)), o = S(a, Q(r)), m = o.mul(a), z = m.mul(a), F = g(o.mul(c)), I = g(m.mul(c)), T = g(z.mul(c)), L = e.sub(o).div(m.sub(o)), O = i(0.3), G = D(
25
+ L.sub(i(1)).add(O),
26
+ i(0)
27
+ ).div(O), p = F.mul(
28
+ S(i(1).sub(h(b.div(y), i(1))), i(3))
29
+ ), M = i(0.5), R = p.sub(G).mul(f), W = C(
30
+ R,
31
+ p.mul(d).sub(
32
+ G.mul(d.sub(f)).mul(M)
33
+ ),
34
+ I
35
+ ), w = i(C(W, p.mul(d), T));
36
+ return U(V(w, i(1 / 127)), () => {
37
+ X();
38
+ }), Y(N, w);
39
+ })();
40
+ }
41
+ // Getters / Setters
42
+ get color() {
43
+ return this.uColor.value;
44
+ }
45
+ set color(t) {
46
+ this.uColor.value = t;
47
+ }
48
+ get gridOpacity() {
49
+ return this.uGridOpacity.value;
50
+ }
51
+ set gridOpacity(t) {
52
+ this.uGridOpacity.value = t;
53
+ }
54
+ get subgridOpacity() {
55
+ return this.uSubgridOpacity.value;
56
+ }
57
+ set subgridOpacity(t) {
58
+ this.uSubgridOpacity.value = t;
59
+ }
60
+ }
61
+ export {
62
+ ii as default
63
+ };