@tomorrowevening/hermes 0.0.128 → 0.0.130
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 +165 -166
- package/dist/hermes.es.js +8533 -8412
- package/package.json +3 -1
- package/types/core/remote/RemoteTheatre.d.ts +9 -0
- package/types/core/types.d.ts +5 -1
- package/types/editor/multiView/InfiniteGridHelper.d.ts +7 -7
- package/types/editor/multiView/InfiniteGridMaterial.d.ts +12 -13
- package/types/editor/multiView/MultiView.d.ts +117 -117
- package/types/editor/sidePanel/inspector/InspectorField.d.ts +2 -1
- package/types/utils/math.d.ts +4 -0
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.0.
|
10
|
+
"version": "0.0.130",
|
11
11
|
"homepage": "https://github.com/tomorrowevening/hermes#readme",
|
12
12
|
"bugs": {
|
13
13
|
"url": "https://github.com/tomorrowevening/hermes/issues"
|
@@ -65,6 +65,8 @@
|
|
65
65
|
"eslint-plugin-react-hooks": "^4.6.0",
|
66
66
|
"eslint-plugin-react-refresh": "^0.4.3",
|
67
67
|
"framer-motion": "^10.16.0",
|
68
|
+
"glslify": "^7.1.1",
|
69
|
+
"glslify-loader": "^2.0.0",
|
68
70
|
"path": "^0.12.7",
|
69
71
|
"postprocessing": "^6.36.3",
|
70
72
|
"react": "^18.2.0",
|
@@ -2,6 +2,12 @@ import { IProject, ISheet, ISheetObject } from '@theatre/core';
|
|
2
2
|
import Application from '../Application';
|
3
3
|
import BaseRemote from './BaseRemote';
|
4
4
|
import { BroadcastData, DataUpdateCallback, VoidCallback } from '../types';
|
5
|
+
type KeyframeVector = {
|
6
|
+
position: number;
|
7
|
+
x: number;
|
8
|
+
y: number;
|
9
|
+
z: number;
|
10
|
+
};
|
5
11
|
export default class RemoteTheatre extends BaseRemote {
|
6
12
|
project: IProject | undefined;
|
7
13
|
sheets: Map<string, ISheet>;
|
@@ -17,8 +23,11 @@ export default class RemoteTheatre extends BaseRemote {
|
|
17
23
|
pauseSheet(name: string, instanceId?: string): void;
|
18
24
|
clearSheetObjects(sheetName: string): void;
|
19
25
|
sheetObject(sheetName: string, key: string, props: any, onUpdate?: DataUpdateCallback, instanceId?: string): ISheetObject | undefined;
|
26
|
+
getSheetObjectKeyframes(sheetName: string, sheetObject: string, prop: string): any[];
|
27
|
+
getSheetObjectVectors(sheetName: string, sheetObject: string): KeyframeVector[];
|
20
28
|
unsubscribe(sheetObject: ISheetObject): undefined;
|
21
29
|
handleApp(app: Application, remote: BaseRemote, msg: BroadcastData): void;
|
22
30
|
handleEditor(app: Application, remote: BaseRemote, msg: BroadcastData): void;
|
23
31
|
handleEditorApp(app: Application, theatre: RemoteTheatre): void;
|
24
32
|
}
|
33
|
+
export {};
|
package/types/core/types.d.ts
CHANGED
@@ -4,6 +4,10 @@ export interface BroadcastData {
|
|
4
4
|
event: EditorEvent;
|
5
5
|
data?: any;
|
6
6
|
}
|
7
|
+
export type OptionInfo = {
|
8
|
+
title: string;
|
9
|
+
value: any;
|
10
|
+
};
|
7
11
|
export interface GroupItemData {
|
8
12
|
type: InspectorFieldType;
|
9
13
|
prop: string;
|
@@ -13,7 +17,7 @@ export interface GroupItemData {
|
|
13
17
|
max?: number;
|
14
18
|
step?: number;
|
15
19
|
disabled?: boolean;
|
16
|
-
options?:
|
20
|
+
options?: OptionInfo[];
|
17
21
|
}
|
18
22
|
export interface GroupData {
|
19
23
|
title: string;
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { Mesh } from 'three';
|
2
|
-
import InfiniteGridMaterial from './InfiniteGridMaterial';
|
3
|
-
export default class InfiniteGridHelper extends Mesh {
|
4
|
-
gridMaterial: InfiniteGridMaterial;
|
5
|
-
constructor();
|
6
|
-
update(): void;
|
7
|
-
}
|
1
|
+
import { Mesh } from 'three';
|
2
|
+
import InfiniteGridMaterial, { InfiniteGridProps } from './InfiniteGridMaterial';
|
3
|
+
export default class InfiniteGridHelper extends Mesh {
|
4
|
+
gridMaterial: InfiniteGridMaterial;
|
5
|
+
constructor(props?: InfiniteGridProps);
|
6
|
+
update(): void;
|
7
|
+
}
|
@@ -1,13 +1,12 @@
|
|
1
|
-
import { Color, ShaderMaterial } from 'three';
|
2
|
-
type InfiniteGridProps = {
|
3
|
-
divisions?: number;
|
4
|
-
scale?: number;
|
5
|
-
color?: Color;
|
6
|
-
distance?: number;
|
7
|
-
subgridOpacity?: number;
|
8
|
-
gridOpacity?: number;
|
9
|
-
};
|
10
|
-
export default class InfiniteGridMaterial extends ShaderMaterial {
|
11
|
-
constructor(props?: InfiniteGridProps);
|
12
|
-
}
|
13
|
-
export {};
|
1
|
+
import { Color, ShaderMaterial } from 'three';
|
2
|
+
export type InfiniteGridProps = {
|
3
|
+
divisions?: number;
|
4
|
+
scale?: number;
|
5
|
+
color?: Color;
|
6
|
+
distance?: number;
|
7
|
+
subgridOpacity?: number;
|
8
|
+
gridOpacity?: number;
|
9
|
+
};
|
10
|
+
export default class InfiniteGridMaterial extends ShaderMaterial {
|
11
|
+
constructor(props?: InfiniteGridProps);
|
12
|
+
}
|
@@ -1,117 +1,117 @@
|
|
1
|
-
import { Component, ReactNode } from 'react';
|
2
|
-
import { Camera, Object3D, OrthographicCamera, PerspectiveCamera, Scene, WebGLRenderer } from 'three';
|
3
|
-
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
|
4
|
-
import RemoteThree from '@/core/remote/RemoteThree';
|
5
|
-
import { InteractionMode, MultiViewMode } from './MultiViewData';
|
6
|
-
import './MultiView.scss';
|
7
|
-
type MultiViewProps = {
|
8
|
-
three: RemoteThree;
|
9
|
-
scenes: Map<string, any>;
|
10
|
-
onSceneSet?: (scene: Scene) => void;
|
11
|
-
onSceneUpdate?: (scene: Scene) => void;
|
12
|
-
onSceneResize?: (scene: Scene, width: number, height: number) => void;
|
13
|
-
};
|
14
|
-
type MultiViewState = {
|
15
|
-
mode: MultiViewMode;
|
16
|
-
modeOpen: boolean;
|
17
|
-
renderModeOpen: boolean;
|
18
|
-
interactionMode: InteractionMode;
|
19
|
-
interactionModeOpen: boolean;
|
20
|
-
lastUpdate: number;
|
21
|
-
};
|
22
|
-
export default class MultiView extends Component<MultiViewProps, MultiViewState> {
|
23
|
-
static instance: MultiView | null;
|
24
|
-
scene: Scene;
|
25
|
-
renderer?: WebGLRenderer | null;
|
26
|
-
currentScene?: Scene;
|
27
|
-
cameras: Map<string, Camera>;
|
28
|
-
controls: Map<string, OrbitControls>;
|
29
|
-
currentCamera: PerspectiveCamera | OrthographicCamera;
|
30
|
-
currentWindow: any;
|
31
|
-
private cameraHelpers;
|
32
|
-
private lightHelpers;
|
33
|
-
private helpersContainer;
|
34
|
-
private grid;
|
35
|
-
private
|
36
|
-
private
|
37
|
-
private
|
38
|
-
private
|
39
|
-
private
|
40
|
-
private
|
41
|
-
private
|
42
|
-
private
|
43
|
-
private
|
44
|
-
private
|
45
|
-
private
|
46
|
-
private
|
47
|
-
private
|
48
|
-
private
|
49
|
-
private
|
50
|
-
private
|
51
|
-
private
|
52
|
-
private
|
53
|
-
private
|
54
|
-
private
|
55
|
-
private
|
56
|
-
private
|
57
|
-
private
|
58
|
-
|
59
|
-
|
60
|
-
private
|
61
|
-
private
|
62
|
-
private
|
63
|
-
private
|
64
|
-
private
|
65
|
-
private
|
66
|
-
private
|
67
|
-
private
|
68
|
-
private
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
private
|
76
|
-
private
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
private
|
82
|
-
private
|
83
|
-
private
|
84
|
-
private
|
85
|
-
private
|
86
|
-
private
|
87
|
-
private
|
88
|
-
private
|
89
|
-
private
|
90
|
-
private
|
91
|
-
private
|
92
|
-
private
|
93
|
-
private
|
94
|
-
private
|
95
|
-
private
|
96
|
-
private
|
97
|
-
private
|
98
|
-
private
|
99
|
-
private
|
100
|
-
private
|
101
|
-
private
|
102
|
-
private
|
103
|
-
private
|
104
|
-
private
|
105
|
-
private
|
106
|
-
private
|
107
|
-
private
|
108
|
-
private drawSingle;
|
109
|
-
private drawDouble;
|
110
|
-
private drawQuad;
|
111
|
-
get appID(): string;
|
112
|
-
get mode(): MultiViewMode;
|
113
|
-
get three(): RemoteThree;
|
114
|
-
get expandedCameraVisibility(): string;
|
115
|
-
get expandedLightVisibility(): string;
|
116
|
-
}
|
117
|
-
export {};
|
1
|
+
import { Component, ReactNode } from 'react';
|
2
|
+
import { Camera, Object3D, OrthographicCamera, PerspectiveCamera, Scene, WebGLRenderer } from 'three';
|
3
|
+
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
|
4
|
+
import RemoteThree from '@/core/remote/RemoteThree';
|
5
|
+
import { InteractionMode, MultiViewMode } from './MultiViewData';
|
6
|
+
import './MultiView.scss';
|
7
|
+
type MultiViewProps = {
|
8
|
+
three: RemoteThree;
|
9
|
+
scenes: Map<string, any>;
|
10
|
+
onSceneSet?: (scene: Scene) => void;
|
11
|
+
onSceneUpdate?: (scene: Scene) => void;
|
12
|
+
onSceneResize?: (scene: Scene, width: number, height: number) => void;
|
13
|
+
};
|
14
|
+
type MultiViewState = {
|
15
|
+
mode: MultiViewMode;
|
16
|
+
modeOpen: boolean;
|
17
|
+
renderModeOpen: boolean;
|
18
|
+
interactionMode: InteractionMode;
|
19
|
+
interactionModeOpen: boolean;
|
20
|
+
lastUpdate: number;
|
21
|
+
};
|
22
|
+
export default class MultiView extends Component<MultiViewProps, MultiViewState> {
|
23
|
+
static instance: MultiView | null;
|
24
|
+
scene: Scene;
|
25
|
+
renderer?: WebGLRenderer | null;
|
26
|
+
currentScene?: Scene;
|
27
|
+
cameras: Map<string, Camera>;
|
28
|
+
controls: Map<string, OrbitControls>;
|
29
|
+
currentCamera: PerspectiveCamera | OrthographicCamera;
|
30
|
+
currentWindow: any;
|
31
|
+
private cameraHelpers;
|
32
|
+
private lightHelpers;
|
33
|
+
private helpersContainer;
|
34
|
+
private grid;
|
35
|
+
private interactionHelper;
|
36
|
+
private currentTransform?;
|
37
|
+
private splineEditor;
|
38
|
+
private depthMaterial;
|
39
|
+
private normalsMaterial;
|
40
|
+
private uvMaterial;
|
41
|
+
private wireframeMaterial;
|
42
|
+
private playing;
|
43
|
+
private rafID;
|
44
|
+
private cameraControlsRafID;
|
45
|
+
private width;
|
46
|
+
private height;
|
47
|
+
private sceneSet;
|
48
|
+
private tlCam;
|
49
|
+
private trCam;
|
50
|
+
private blCam;
|
51
|
+
private brCam;
|
52
|
+
private tlRender;
|
53
|
+
private trRender;
|
54
|
+
private blRender;
|
55
|
+
private brRender;
|
56
|
+
private cameraVisibility;
|
57
|
+
private lightVisibility;
|
58
|
+
selectedItem: Object3D | undefined;
|
59
|
+
private debugCamera;
|
60
|
+
private raycaster;
|
61
|
+
private pointer;
|
62
|
+
private cameraControls;
|
63
|
+
private canvasRef;
|
64
|
+
private containerRef;
|
65
|
+
private tlWindow;
|
66
|
+
private trWindow;
|
67
|
+
private blWindow;
|
68
|
+
private brWindow;
|
69
|
+
constructor(props: MultiViewProps);
|
70
|
+
componentDidMount(): void;
|
71
|
+
componentDidUpdate(prevProps: Readonly<MultiViewProps>, prevState: Readonly<MultiViewState>, snapshot?: any): void;
|
72
|
+
componentWillUnmount(): void;
|
73
|
+
render(): ReactNode;
|
74
|
+
private setupRenderer;
|
75
|
+
private setupScene;
|
76
|
+
private setupTools;
|
77
|
+
play(): void;
|
78
|
+
pause(): void;
|
79
|
+
toggleOrbitControls(value: boolean): void;
|
80
|
+
private update;
|
81
|
+
private draw;
|
82
|
+
private onUpdate;
|
83
|
+
private enable;
|
84
|
+
private disable;
|
85
|
+
private resize;
|
86
|
+
private sceneUpdate;
|
87
|
+
private addCamera;
|
88
|
+
private removeCamera;
|
89
|
+
private onMouseMove;
|
90
|
+
private onClick;
|
91
|
+
private onKey;
|
92
|
+
private onSetSelectedItem;
|
93
|
+
private updateSelectedItemHelper;
|
94
|
+
private onUpdateTransform;
|
95
|
+
private clearLightHelpers;
|
96
|
+
private addLightHelpers;
|
97
|
+
private createControls;
|
98
|
+
private clearCamera;
|
99
|
+
private killControls;
|
100
|
+
private assignControls;
|
101
|
+
private updateCamera;
|
102
|
+
private updateCameraControls;
|
103
|
+
private clearControls;
|
104
|
+
private saveExpandedCameraVisibility;
|
105
|
+
private saveExpandedLightVisibility;
|
106
|
+
private getSceneOverride;
|
107
|
+
private drawTo;
|
108
|
+
private drawSingle;
|
109
|
+
private drawDouble;
|
110
|
+
private drawQuad;
|
111
|
+
get appID(): string;
|
112
|
+
get mode(): MultiViewMode;
|
113
|
+
get three(): RemoteThree;
|
114
|
+
get expandedCameraVisibility(): string;
|
115
|
+
get expandedLightVisibility(): string;
|
116
|
+
}
|
117
|
+
export {};
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { KeyboardEvent } from 'react';
|
2
|
+
import { OptionInfo } from '@/core/types';
|
2
3
|
export type InspectorFieldType = 'string' | 'number' | 'boolean' | 'range' | 'color' | 'button' | 'image' | 'option' | 'vector2' | 'grid3' | 'grid4' | 'euler';
|
3
4
|
export interface InspectorFieldProps {
|
4
5
|
title: string;
|
@@ -9,7 +10,7 @@ export interface InspectorFieldProps {
|
|
9
10
|
max?: number;
|
10
11
|
step?: number;
|
11
12
|
disabled?: boolean;
|
12
|
-
options?:
|
13
|
+
options?: OptionInfo[];
|
13
14
|
onChange?: (prop: string, value: any) => void;
|
14
15
|
onKeyDown?: (evt: KeyboardEvent) => void;
|
15
16
|
}
|
package/types/utils/math.d.ts
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
export declare function clamp(min: number, max: number, value: number): number;
|
2
2
|
export declare function normalize(min: number, max: number, value: number): number;
|
3
3
|
export declare function mix(min: number, max: number, value: number): number;
|
4
|
+
export declare function map(min1: number, max1: number, min2: number, max2: number, value: number): number;
|
4
5
|
export declare function distance(x: number, y: number): number;
|
5
6
|
export declare function round(value: number, precision?: number): number;
|
7
|
+
export declare function damp(start: number, end: number, easing: number, dt: number): number;
|
8
|
+
export declare function roundTo(value: number, digits?: number): number;
|
9
|
+
export declare function cubicBezier(percent: number, x0: number, y0: number, x1: number, y1: number): number;
|