@tomorrowevening/hermes 0.0.140 → 0.0.142
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 +34 -34
- package/dist/hermes.css +1 -0
- package/dist/hermes.es.js +2098 -2009
- package/package.json +3 -3
- package/types/core/remote/RemoteTheatre.d.ts +34 -34
- package/types/core/remote/RemoteThree.d.ts +43 -43
- package/types/core/types.d.ts +40 -39
- package/types/editor/multiView/MultiView.d.ts +2 -2
- package/types/editor/sidePanel/SidePanel.d.ts +3 -3
- package/types/editor/sidePanel/inspector/InspectorField.d.ts +17 -17
- package/types/editor/sidePanel/inspector/utils/InspectRenderer.d.ts +32 -32
- package/types/editor/theatreUtils.d.ts +4 -4
- package/types/editor/tools/splineEditor/Spline.d.ts +53 -52
- package/types/editor/tools/splineEditor/index.d.ts +34 -29
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.142",
|
11
11
|
"homepage": "https://github.com/tomorrowevening/hermes#readme",
|
12
12
|
"bugs": {
|
13
13
|
"url": "https://github.com/tomorrowevening/hermes/issues"
|
@@ -21,7 +21,7 @@
|
|
21
21
|
"files": [
|
22
22
|
"dist/hermes.es.js",
|
23
23
|
"dist/hermes.cjs.js",
|
24
|
-
"dist/
|
24
|
+
"dist/hermes.css",
|
25
25
|
"types/**/*.d.ts"
|
26
26
|
],
|
27
27
|
"exports": {
|
@@ -30,7 +30,7 @@
|
|
30
30
|
"import": "./dist/hermes.es.js",
|
31
31
|
"require": "./dist/hermes.cjs.js"
|
32
32
|
},
|
33
|
-
"./
|
33
|
+
"./hermes.css": "./dist/hermes.css"
|
34
34
|
},
|
35
35
|
"repository": {
|
36
36
|
"type": "git",
|
@@ -1,34 +1,34 @@
|
|
1
|
-
import { IProject, ISheet, ISheetObject } from '@theatre/core';
|
2
|
-
import BaseRemote from './BaseRemote';
|
3
|
-
import { BroadcastData, DataUpdateCallback, VoidCallback } from '../types';
|
4
|
-
import { Application } from '../Application';
|
5
|
-
type KeyframeVector = {
|
6
|
-
position: number;
|
7
|
-
x: number;
|
8
|
-
y: number;
|
9
|
-
z: number;
|
10
|
-
};
|
11
|
-
export default class RemoteTheatre extends BaseRemote {
|
12
|
-
project: IProject | undefined;
|
13
|
-
sheets: Map<string, ISheet>;
|
14
|
-
sheetObjects: Map<string, ISheetObject>;
|
15
|
-
sheetObjectCBs: Map<string, DataUpdateCallback>;
|
16
|
-
sheetObjectUnsubscribe: Map<string, VoidCallback>;
|
17
|
-
activeSheet: ISheet | undefined;
|
18
|
-
studio: any;
|
19
|
-
constructor(app: Application);
|
20
|
-
dispose(): void;
|
21
|
-
getSheetInstance(name: string, instanceId?: string): string;
|
22
|
-
sheet(name: string, instanceId?: string): ISheet | undefined;
|
23
|
-
playSheet(name: string, params?: any, instanceId?: string): Promise<boolean>;
|
24
|
-
pauseSheet(name: string, instanceId?: string): void;
|
25
|
-
clearSheetObjects(sheetName: string): void;
|
26
|
-
sheetObject(sheetName: string, key: string, props: any, onUpdate?: DataUpdateCallback, instanceId?: string): ISheetObject | undefined;
|
27
|
-
getSheetObjectKeyframes(sheetName: string, sheetObject: string, prop: string): any[];
|
28
|
-
getSheetObjectVectors(sheetName: string, sheetObject: string): KeyframeVector[];
|
29
|
-
unsubscribe(sheetObject: ISheetObject): undefined;
|
30
|
-
handleApp(msg: BroadcastData): void;
|
31
|
-
handleEditor(msg: BroadcastData): void;
|
32
|
-
handleEditorApp(): void;
|
33
|
-
}
|
34
|
-
export {};
|
1
|
+
import { IProject, ISheet, ISheetObject } from '@theatre/core';
|
2
|
+
import BaseRemote from './BaseRemote';
|
3
|
+
import { BroadcastData, DataUpdateCallback, VoidCallback } from '../types';
|
4
|
+
import { Application } from '../Application';
|
5
|
+
type KeyframeVector = {
|
6
|
+
position: number;
|
7
|
+
x: number;
|
8
|
+
y: number;
|
9
|
+
z: number;
|
10
|
+
};
|
11
|
+
export default class RemoteTheatre extends BaseRemote {
|
12
|
+
project: IProject | undefined;
|
13
|
+
sheets: Map<string, ISheet>;
|
14
|
+
sheetObjects: Map<string, ISheetObject>;
|
15
|
+
sheetObjectCBs: Map<string, DataUpdateCallback>;
|
16
|
+
sheetObjectUnsubscribe: Map<string, VoidCallback>;
|
17
|
+
activeSheet: ISheet | undefined;
|
18
|
+
studio: any;
|
19
|
+
constructor(app: Application);
|
20
|
+
dispose(): void;
|
21
|
+
getSheetInstance(name: string, instanceId?: string): string;
|
22
|
+
sheet(name: string, instanceId?: string): ISheet | undefined;
|
23
|
+
playSheet(name: string, params?: any, instanceId?: string): Promise<boolean>;
|
24
|
+
pauseSheet(name: string, instanceId?: string): void;
|
25
|
+
clearSheetObjects(sheetName: string): void;
|
26
|
+
sheetObject(sheetName: string, key: string, props: any, onUpdate?: DataUpdateCallback, instanceId?: string): ISheetObject | undefined;
|
27
|
+
getSheetObjectKeyframes(sheetName: string, sheetObject: string, prop: string): any[];
|
28
|
+
getSheetObjectVectors(sheetName: string, sheetObject: string): KeyframeVector[];
|
29
|
+
unsubscribe(sheetObject: ISheetObject): undefined;
|
30
|
+
handleApp(msg: BroadcastData): void;
|
31
|
+
handleEditor(msg: BroadcastData): void;
|
32
|
+
handleEditorApp(): void;
|
33
|
+
}
|
34
|
+
export {};
|
@@ -1,43 +1,43 @@
|
|
1
|
-
import { Camera, Curve, RenderTargetOptions, Scene, RenderTarget } from 'three';
|
2
|
-
import { Application } from '../Application';
|
3
|
-
import BaseRemote from './BaseRemote';
|
4
|
-
import { BroadcastData, GroupData } from '../types';
|
5
|
-
export default class RemoteThree extends BaseRemote {
|
6
|
-
canvas: HTMLCanvasElement | null;
|
7
|
-
inputElement: any;
|
8
|
-
scene?: Scene;
|
9
|
-
scenes: Map<string, Scene>;
|
10
|
-
renderer?: any;
|
11
|
-
renderTargets: Map<string, RenderTarget>;
|
12
|
-
private groups;
|
13
|
-
constructor(app: Application);
|
14
|
-
dispose(): void;
|
15
|
-
getObject(uuid: string): void;
|
16
|
-
setObject(value: any): void;
|
17
|
-
requestMethod(uuid: string, key: string, value?: any, subitem?: string): void;
|
18
|
-
updateObject(uuid: string, key: string, value: any): void;
|
19
|
-
createTexture(uuid: string, key: string, value: any): void;
|
20
|
-
addGroup(data: GroupData): void;
|
21
|
-
removeGroup(name: string): void;
|
22
|
-
updateGroup(group: string, prop: string, value: any): void;
|
23
|
-
removeAllGroups(): void;
|
24
|
-
addSpline(spline: Curve<any>): void;
|
25
|
-
setRenderer(value: any, inputElement?: any): void;
|
26
|
-
updateRenderer(data: any): void;
|
27
|
-
addScene(value: Scene): void;
|
28
|
-
refreshScene(value: string): void;
|
29
|
-
removeScene(value: Scene): void;
|
30
|
-
removeAllScenes(): void;
|
31
|
-
getScene(uuid: string): Scene | null;
|
32
|
-
setScene(value: Scene): void;
|
33
|
-
addCamera(camera: Camera): void;
|
34
|
-
removeCamera(camera: Camera): void;
|
35
|
-
handleApp(msg: BroadcastData): void;
|
36
|
-
handleEditor(msg: BroadcastData): void;
|
37
|
-
addRT(name: string, params?: RenderTargetOptions): void;
|
38
|
-
resize(width: number, height: number): void;
|
39
|
-
set dpr(value: number);
|
40
|
-
get dpr(): number;
|
41
|
-
get width(): number;
|
42
|
-
get height(): number;
|
43
|
-
}
|
1
|
+
import { Camera, Curve, RenderTargetOptions, Scene, RenderTarget } from 'three';
|
2
|
+
import { Application } from '../Application';
|
3
|
+
import BaseRemote from './BaseRemote';
|
4
|
+
import { BroadcastData, GroupData } from '../types';
|
5
|
+
export default class RemoteThree extends BaseRemote {
|
6
|
+
canvas: HTMLCanvasElement | null;
|
7
|
+
inputElement: any;
|
8
|
+
scene?: Scene;
|
9
|
+
scenes: Map<string, Scene>;
|
10
|
+
renderer?: any;
|
11
|
+
renderTargets: Map<string, RenderTarget>;
|
12
|
+
private groups;
|
13
|
+
constructor(app: Application);
|
14
|
+
dispose(): void;
|
15
|
+
getObject(uuid: string): void;
|
16
|
+
setObject(value: any): void;
|
17
|
+
requestMethod(uuid: string, key: string, value?: any, subitem?: string): void;
|
18
|
+
updateObject(uuid: string, key: string, value: any): void;
|
19
|
+
createTexture(uuid: string, key: string, value: any): void;
|
20
|
+
addGroup(data: GroupData): void;
|
21
|
+
removeGroup(name: string): void;
|
22
|
+
updateGroup(group: string, prop: string, value: any): void;
|
23
|
+
removeAllGroups(): void;
|
24
|
+
addSpline(spline: Curve<any>): void;
|
25
|
+
setRenderer(value: any, inputElement?: any): void;
|
26
|
+
updateRenderer(data: any): void;
|
27
|
+
addScene(value: Scene): void;
|
28
|
+
refreshScene(value: string): void;
|
29
|
+
removeScene(value: Scene): void;
|
30
|
+
removeAllScenes(): void;
|
31
|
+
getScene(uuid: string): Scene | null;
|
32
|
+
setScene(value: Scene): void;
|
33
|
+
addCamera(camera: Camera): void;
|
34
|
+
removeCamera(camera: Camera): void;
|
35
|
+
handleApp(msg: BroadcastData): void;
|
36
|
+
handleEditor(msg: BroadcastData): void;
|
37
|
+
addRT(name: string, params?: RenderTargetOptions): void;
|
38
|
+
resize(width: number, height: number): void;
|
39
|
+
set dpr(value: number);
|
40
|
+
get dpr(): number;
|
41
|
+
get width(): number;
|
42
|
+
get height(): number;
|
43
|
+
}
|
package/types/core/types.d.ts
CHANGED
@@ -1,39 +1,40 @@
|
|
1
|
-
import { InspectorFieldType } from '@/editor/sidePanel/inspector/InspectorField';
|
2
|
-
export interface BroadcastData {
|
3
|
-
target: ApplicationMode;
|
4
|
-
event: EditorEvent;
|
5
|
-
data?: any;
|
6
|
-
}
|
7
|
-
export type OptionInfo = {
|
8
|
-
title: string;
|
9
|
-
value: any;
|
10
|
-
};
|
11
|
-
export interface GroupItemData {
|
12
|
-
type: InspectorFieldType;
|
13
|
-
prop: string;
|
14
|
-
title?: string;
|
15
|
-
value?: any;
|
16
|
-
min?: number;
|
17
|
-
max?: number;
|
18
|
-
step?: number;
|
19
|
-
disabled?: boolean;
|
20
|
-
options?: OptionInfo[];
|
21
|
-
}
|
22
|
-
export interface GroupData {
|
23
|
-
title: string;
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
export type
|
33
|
-
export type
|
34
|
-
export type
|
35
|
-
export type
|
36
|
-
export type
|
37
|
-
export type
|
38
|
-
export
|
39
|
-
export declare const
|
1
|
+
import { InspectorFieldType } from '@/editor/sidePanel/inspector/InspectorField';
|
2
|
+
export interface BroadcastData {
|
3
|
+
target: ApplicationMode;
|
4
|
+
event: EditorEvent;
|
5
|
+
data?: any;
|
6
|
+
}
|
7
|
+
export type OptionInfo = {
|
8
|
+
title: string;
|
9
|
+
value: any;
|
10
|
+
};
|
11
|
+
export interface GroupItemData {
|
12
|
+
type: InspectorFieldType;
|
13
|
+
prop: string;
|
14
|
+
title?: string;
|
15
|
+
value?: any;
|
16
|
+
min?: number;
|
17
|
+
max?: number;
|
18
|
+
step?: number;
|
19
|
+
disabled?: boolean;
|
20
|
+
options?: OptionInfo[];
|
21
|
+
}
|
22
|
+
export interface GroupData {
|
23
|
+
title: string;
|
24
|
+
expanded?: boolean;
|
25
|
+
items: GroupItemData[];
|
26
|
+
onUpdate: (prop: string, value: any) => void;
|
27
|
+
}
|
28
|
+
export interface GroupCallback {
|
29
|
+
title: string;
|
30
|
+
onUpdate: (prop: string, value: any) => void;
|
31
|
+
}
|
32
|
+
export type ApplicationMode = 'app' | 'editor';
|
33
|
+
export type VoidCallback = () => void;
|
34
|
+
export type DataUpdateCallback = (data: any) => void;
|
35
|
+
export type EditorEvent = 'custom' | 'setSheet' | 'setSheetObject' | 'updateSheetObject' | 'updateTimeline' | 'playSheet' | 'pauseSheet' | 'getObject' | 'setObject' | 'updateObject' | 'addScene' | 'refreshScene' | 'removeScene' | 'setScene' | 'createTexture' | 'requestMethod' | 'addCamera' | 'removeCamera' | 'addSpline' | 'addRenderer' | 'updateRenderer' | 'addFolder' | 'bindObject' | 'updateBind' | 'addButton' | 'clickButton' | 'selectComponent' | 'draggableListUpdate' | 'addGroup' | 'removeGroup' | 'updateGroup';
|
36
|
+
export type VoidFunc = () => void;
|
37
|
+
export type BroadcastCallback = (data: BroadcastData) => void;
|
38
|
+
export type TheatreUpdateCallback = (data: any) => void;
|
39
|
+
export declare const noop: () => void;
|
40
|
+
export declare const defaultTheatreCallback: TheatreUpdateCallback;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Component, ReactNode } from 'react';
|
2
|
-
import { Camera, Object3D, OrthographicCamera, PerspectiveCamera, Scene, WebGLRenderer } from 'three';
|
2
|
+
import { Camera, Group, Object3D, OrthographicCamera, PerspectiveCamera, Scene, WebGLRenderer } from 'three';
|
3
3
|
import WebGPURenderer from 'three/src/renderers/webgpu/WebGPURenderer';
|
4
4
|
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
|
5
5
|
import RemoteThree from '@/core/remote/RemoteThree';
|
@@ -32,9 +32,9 @@ export default class MultiView extends Component<MultiViewProps, MultiViewState>
|
|
32
32
|
controls: Map<string, OrbitControls>;
|
33
33
|
currentCamera: PerspectiveCamera | OrthographicCamera;
|
34
34
|
currentWindow: any;
|
35
|
+
helpersContainer: Group<import("three").Object3DEventMap>;
|
35
36
|
private cameraHelpers;
|
36
37
|
private lightHelpers;
|
37
|
-
private helpersContainer;
|
38
38
|
private grid;
|
39
39
|
private interactionHelper;
|
40
40
|
private currentTransform?;
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import { SidePanelState } from './types';
|
2
|
-
import '../scss/sidePanel.scss';
|
3
|
-
export default function SidePanel(props: SidePanelState): import("react/jsx-runtime").JSX.Element;
|
1
|
+
import { SidePanelState } from './types';
|
2
|
+
import '../scss/sidePanel.scss';
|
3
|
+
export default function SidePanel(props: SidePanelState): import("react/jsx-runtime").JSX.Element;
|
@@ -1,17 +1,17 @@
|
|
1
|
-
import { KeyboardEvent } from 'react';
|
2
|
-
import { OptionInfo } from '@/core/types';
|
3
|
-
export type InspectorFieldType = 'string' | 'number' | 'boolean' | 'range' | 'color' | 'button' | 'image' | 'option' | 'vector2' | 'grid3' | 'grid4' | 'euler';
|
4
|
-
export interface InspectorFieldProps {
|
5
|
-
title: string;
|
6
|
-
type: InspectorFieldType;
|
7
|
-
prop?: string;
|
8
|
-
value?: any;
|
9
|
-
min?: number;
|
10
|
-
max?: number;
|
11
|
-
step?: number;
|
12
|
-
disabled?: boolean;
|
13
|
-
options?: OptionInfo[];
|
14
|
-
onChange?: (prop: string, value: any) => void;
|
15
|
-
onKeyDown?: (evt: KeyboardEvent) => void;
|
16
|
-
}
|
17
|
-
export default function InspectorField(props: InspectorFieldProps): import("react/jsx-runtime").JSX.Element;
|
1
|
+
import { KeyboardEvent } from 'react';
|
2
|
+
import { OptionInfo } from '@/core/types';
|
3
|
+
export type InspectorFieldType = 'string' | 'field' | 'number' | 'boolean' | 'range' | 'color' | 'button' | 'image' | 'option' | 'vector2' | 'grid3' | 'grid4' | 'euler';
|
4
|
+
export interface InspectorFieldProps {
|
5
|
+
title: string;
|
6
|
+
type: InspectorFieldType;
|
7
|
+
prop?: string;
|
8
|
+
value?: any;
|
9
|
+
min?: number;
|
10
|
+
max?: number;
|
11
|
+
step?: number;
|
12
|
+
disabled?: boolean;
|
13
|
+
options?: OptionInfo[];
|
14
|
+
onChange?: (prop: string, value: any) => void;
|
15
|
+
onKeyDown?: (evt: KeyboardEvent) => void;
|
16
|
+
}
|
17
|
+
export default function InspectorField(props: InspectorFieldProps): import("react/jsx-runtime").JSX.Element;
|
@@ -1,32 +1,32 @@
|
|
1
|
-
import { Component, ReactNode } from 'react';
|
2
|
-
import { Application } from '@/core/Application';
|
3
|
-
import RemoteThree from '@/core/remote/RemoteThree';
|
4
|
-
type InspectRendererProps = {
|
5
|
-
app: Application;
|
6
|
-
three: RemoteThree;
|
7
|
-
};
|
8
|
-
type InspectRendererState = {
|
9
|
-
expanded: boolean;
|
10
|
-
lastUpdated: number;
|
11
|
-
};
|
12
|
-
export default class InspectRenderer extends Component<InspectRendererProps, InspectRendererState> {
|
13
|
-
private app;
|
14
|
-
private autoClear;
|
15
|
-
private autoClearColor;
|
16
|
-
private autoClearDepth;
|
17
|
-
private autoClearStencil;
|
18
|
-
private outputColorSpace;
|
19
|
-
private localClippingEnabled;
|
20
|
-
private clearColor;
|
21
|
-
private clearAlpha;
|
22
|
-
private toneMapping;
|
23
|
-
private toneMappingExposure;
|
24
|
-
private type;
|
25
|
-
constructor(props: InspectRendererProps);
|
26
|
-
componentwillunmount(): void;
|
27
|
-
private onAddRenderer;
|
28
|
-
render(): ReactNode;
|
29
|
-
private saveExpanded;
|
30
|
-
get expandedName(): string;
|
31
|
-
}
|
32
|
-
export {};
|
1
|
+
import { Component, ReactNode } from 'react';
|
2
|
+
import { Application } from '@/core/Application';
|
3
|
+
import RemoteThree from '@/core/remote/RemoteThree';
|
4
|
+
type InspectRendererProps = {
|
5
|
+
app: Application;
|
6
|
+
three: RemoteThree;
|
7
|
+
};
|
8
|
+
type InspectRendererState = {
|
9
|
+
expanded: boolean;
|
10
|
+
lastUpdated: number;
|
11
|
+
};
|
12
|
+
export default class InspectRenderer extends Component<InspectRendererProps, InspectRendererState> {
|
13
|
+
private app;
|
14
|
+
private autoClear;
|
15
|
+
private autoClearColor;
|
16
|
+
private autoClearDepth;
|
17
|
+
private autoClearStencil;
|
18
|
+
private outputColorSpace;
|
19
|
+
private localClippingEnabled;
|
20
|
+
private clearColor;
|
21
|
+
private clearAlpha;
|
22
|
+
private toneMapping;
|
23
|
+
private toneMappingExposure;
|
24
|
+
private type;
|
25
|
+
constructor(props: InspectRendererProps);
|
26
|
+
componentwillunmount(): void;
|
27
|
+
private onAddRenderer;
|
28
|
+
render(): ReactNode;
|
29
|
+
private saveExpanded;
|
30
|
+
get expandedName(): string;
|
31
|
+
}
|
32
|
+
export {};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Application } from '../core/Application';
|
2
|
-
import RemoteTheatre from '../core/remote/RemoteTheatre';
|
3
|
-
export declare function theatreEditorApp(app: Application, theatre: RemoteTheatre, studio: any): void;
|
4
|
-
export declare function customizeTheatreElements(): void
|
1
|
+
import { Application } from '../core/Application';
|
2
|
+
import RemoteTheatre from '../core/remote/RemoteTheatre';
|
3
|
+
export declare function theatreEditorApp(app: Application, theatre: RemoteTheatre, studio: any): void;
|
4
|
+
export declare function customizeTheatreElements(): Promise<void>;
|
@@ -1,52 +1,53 @@
|
|
1
|
-
import { Camera, CatmullRomCurve3, Line, Mesh, Object3D, Vector3 } from 'three';
|
2
|
-
import InspectorGroup from '@/editor/sidePanel/inspector/InspectorGroup';
|
3
|
-
export type CurveType = 'catmullrom' | 'centripetal' | 'chordal';
|
4
|
-
export default class Spline extends Object3D {
|
5
|
-
curve: CatmullRomCurve3;
|
6
|
-
line: Line;
|
7
|
-
draggable: Object3D;
|
8
|
-
curvePos: Mesh;
|
9
|
-
tension: number;
|
10
|
-
closed: boolean;
|
11
|
-
subdivide: number;
|
12
|
-
curveType: CurveType;
|
13
|
-
offset: number;
|
14
|
-
private lineMaterial;
|
15
|
-
private _camera;
|
16
|
-
private _curvePercentage;
|
17
|
-
private _draggableScale;
|
18
|
-
private _transform?;
|
19
|
-
private raycaster;
|
20
|
-
private draggedMat;
|
21
|
-
private parentGroup;
|
22
|
-
private group;
|
23
|
-
constructor(name: string, camera: Camera);
|
24
|
-
enable(): void;
|
25
|
-
disable(): void;
|
26
|
-
dispose: () => void;
|
27
|
-
hideTransform: () => void;
|
28
|
-
exportSpline: () => void;
|
29
|
-
showPoints: (visible?: boolean) => void;
|
30
|
-
addPoints: (pts?: Array<Vector3>) => void;
|
31
|
-
addPoint: (position: Vector3, update?: boolean) => Mesh;
|
32
|
-
addNextPt: () => void;
|
33
|
-
removePoint: (child: Object3D) => void;
|
34
|
-
removePointAt: (index: number) => void;
|
35
|
-
removeSelectedPt: () => void;
|
36
|
-
updateSpline: () => void;
|
37
|
-
private onMouseClick;
|
38
|
-
getPointAt(percentage: number): Vector3;
|
39
|
-
getPoints(): Vector3[];
|
40
|
-
getTangentAt(percentage: number): Vector3;
|
41
|
-
get points(): Array<Vector3>;
|
42
|
-
get total(): number;
|
43
|
-
get draggableScale(): number;
|
44
|
-
set draggableScale(value: number);
|
45
|
-
get camera(): Camera;
|
46
|
-
set camera(value: Camera);
|
47
|
-
get curvePercentage(): number;
|
48
|
-
set curvePercentage(value: number);
|
49
|
-
private
|
50
|
-
|
51
|
-
|
52
|
-
|
1
|
+
import { Camera, CatmullRomCurve3, Line, Mesh, Object3D, Vector3 } from 'three';
|
2
|
+
import InspectorGroup from '@/editor/sidePanel/inspector/InspectorGroup';
|
3
|
+
export type CurveType = 'catmullrom' | 'centripetal' | 'chordal';
|
4
|
+
export default class Spline extends Object3D {
|
5
|
+
curve: CatmullRomCurve3;
|
6
|
+
line: Line;
|
7
|
+
draggable: Object3D;
|
8
|
+
curvePos: Mesh;
|
9
|
+
tension: number;
|
10
|
+
closed: boolean;
|
11
|
+
subdivide: number;
|
12
|
+
curveType: CurveType;
|
13
|
+
offset: number;
|
14
|
+
private lineMaterial;
|
15
|
+
private _camera;
|
16
|
+
private _curvePercentage;
|
17
|
+
private _draggableScale;
|
18
|
+
private _transform?;
|
19
|
+
private raycaster;
|
20
|
+
private draggedMat;
|
21
|
+
private parentGroup;
|
22
|
+
private group;
|
23
|
+
constructor(name: string, camera: Camera);
|
24
|
+
enable(): void;
|
25
|
+
disable(): void;
|
26
|
+
dispose: () => void;
|
27
|
+
hideTransform: () => void;
|
28
|
+
exportSpline: () => void;
|
29
|
+
showPoints: (visible?: boolean) => void;
|
30
|
+
addPoints: (pts?: Array<Vector3>) => void;
|
31
|
+
addPoint: (position: Vector3, update?: boolean) => Mesh;
|
32
|
+
addNextPt: () => void;
|
33
|
+
removePoint: (child: Object3D) => void;
|
34
|
+
removePointAt: (index: number) => void;
|
35
|
+
removeSelectedPt: () => void;
|
36
|
+
updateSpline: () => void;
|
37
|
+
private onMouseClick;
|
38
|
+
getPointAt(percentage: number): Vector3;
|
39
|
+
getPoints(): Vector3[];
|
40
|
+
getTangentAt(percentage: number): Vector3;
|
41
|
+
get points(): Array<Vector3>;
|
42
|
+
get total(): number;
|
43
|
+
get draggableScale(): number;
|
44
|
+
set draggableScale(value: number);
|
45
|
+
get camera(): Camera;
|
46
|
+
set camera(value: Camera);
|
47
|
+
get curvePercentage(): number;
|
48
|
+
set curvePercentage(value: number);
|
49
|
+
private updateCurrentPoint;
|
50
|
+
private onUpdateTransform;
|
51
|
+
initDebug(parentGroup: InspectorGroup): void;
|
52
|
+
private debugPoint;
|
53
|
+
}
|
@@ -1,29 +1,34 @@
|
|
1
|
-
import { Camera, CatmullRomCurve3, Object3D, Vector3 } from 'three';
|
2
|
-
import Spline from './Spline';
|
3
|
-
import { Application } from '@/core/Application';
|
4
|
-
export type SplineJSON = {
|
5
|
-
name: string;
|
6
|
-
points: Array<number[]>;
|
7
|
-
tension: number;
|
8
|
-
closed: boolean;
|
9
|
-
subdivide: number;
|
10
|
-
type: string;
|
11
|
-
};
|
12
|
-
export default class SplineEditor extends Object3D {
|
13
|
-
defaultScale: number;
|
14
|
-
|
15
|
-
private
|
16
|
-
private
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
1
|
+
import { Camera, CatmullRomCurve3, Object3D, Vector3 } from 'three';
|
2
|
+
import Spline from './Spline';
|
3
|
+
import { Application } from '@/core/Application';
|
4
|
+
export type SplineJSON = {
|
5
|
+
name: string;
|
6
|
+
points: Array<number[]>;
|
7
|
+
tension: number;
|
8
|
+
closed: boolean;
|
9
|
+
subdivide: number;
|
10
|
+
type: string;
|
11
|
+
};
|
12
|
+
export default class SplineEditor extends Object3D {
|
13
|
+
defaultScale: number;
|
14
|
+
currentSpline: Spline | null;
|
15
|
+
private _camera;
|
16
|
+
private group;
|
17
|
+
private app;
|
18
|
+
private splineDataText;
|
19
|
+
constructor(camera: Camera, app: Application);
|
20
|
+
initDebug(): void;
|
21
|
+
dispose(): void;
|
22
|
+
addSpline(spline: Spline): void;
|
23
|
+
createSpline: (defaultPoints?: Array<Vector3>) => Spline;
|
24
|
+
createSplineFromArray: (points: Array<number[]>) => Spline;
|
25
|
+
createSplineFromCatmullRom: (curve: CatmullRomCurve3) => Spline;
|
26
|
+
createSplineFromJSON: (data: SplineJSON) => Spline;
|
27
|
+
showPoints: (visible?: boolean) => void;
|
28
|
+
private onAddSpline;
|
29
|
+
private enableClickToDraw;
|
30
|
+
private disableClickToDraw;
|
31
|
+
private onClickCanvas;
|
32
|
+
get camera(): Camera;
|
33
|
+
set camera(value: Camera);
|
34
|
+
}
|