@tomorrowevening/hermes 0.0.8 → 0.0.11

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 (35) hide show
  1. package/dist/hermes.js +1614 -1528
  2. package/dist/hermes.umd.cjs +51 -13
  3. package/dist/style.css +1 -1
  4. package/package.json +3 -1
  5. package/src/core/RemoteController.ts +0 -3
  6. package/src/core/remote/RemoteThree.ts +5 -10
  7. package/src/core/types.ts +0 -1
  8. package/src/editor/global.ts +0 -1
  9. package/src/editor/{sceneHierarchy/inspector/MultiView → multiView}/MultiView.scss +6 -0
  10. package/src/editor/{sceneHierarchy/inspector/MultiView → multiView}/MultiView.tsx +110 -118
  11. package/src/editor/multiView/MultiViewData.ts +59 -0
  12. package/src/editor/multiView/UVMaterial.ts +55 -0
  13. package/src/editor/sceneHierarchy/SceneHierarchy.tsx +7 -21
  14. package/src/editor/sceneHierarchy/inspector/SceneInspector.tsx +16 -11
  15. package/src/editor/sceneHierarchy/inspector/utils/InspectMaterial.tsx +1 -0
  16. package/src/editor/sceneHierarchy/inspector/utils/InspectTransform.tsx +35 -46
  17. package/src/editor/utils.ts +60 -4
  18. package/src/index.ts +3 -2
  19. package/types/core/remote/RemoteThree.d.ts +0 -1
  20. package/types/core/types.d.ts +1 -1
  21. package/types/editor/global.d.ts +0 -1
  22. package/types/editor/multiView/MultiView.d.ts +9 -0
  23. package/types/editor/multiView/MultiViewData.d.ts +16 -0
  24. package/types/editor/multiView/UVMaterial.d.ts +4 -0
  25. package/types/editor/sceneHierarchy/SceneHierarchy.d.ts +0 -2
  26. package/types/editor/sceneHierarchy/inspector/SceneInspector.d.ts +0 -2
  27. package/types/editor/utils.d.ts +7 -1
  28. package/types/index.d.ts +3 -2
  29. package/types/editor/sceneHierarchy/inspector/MultiView/MultiView.d.ts +0 -11
  30. /package/src/editor/{sceneHierarchy/inspector/MultiView → multiView}/CameraWindow.tsx +0 -0
  31. /package/src/editor/{sceneHierarchy/inspector/MultiView → multiView}/InfiniteGridHelper.ts +0 -0
  32. /package/src/editor/{sceneHierarchy/inspector/MultiView → multiView}/InfiniteGridMaterial.ts +0 -0
  33. /package/types/editor/{sceneHierarchy/inspector/MultiView → multiView}/CameraWindow.d.ts +0 -0
  34. /package/types/editor/{sceneHierarchy/inspector/MultiView → multiView}/InfiniteGridHelper.d.ts +0 -0
  35. /package/types/editor/{sceneHierarchy/inspector/MultiView → multiView}/InfiniteGridMaterial.d.ts +0 -0
@@ -0,0 +1,59 @@
1
+ import { Camera, CameraHelper, MeshBasicMaterial, MeshDepthMaterial, MeshNormalMaterial, OrthographicCamera, PerspectiveCamera, Vector3 } from 'three';
2
+ import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
3
+ import UVMaterial from './UVMaterial';
4
+
5
+ export type MultiViewMode = 'Single' | 'Side by Side' | 'Stacked' |'Quad';
6
+ export const ModeOptions: MultiViewMode[] = [
7
+ 'Single',
8
+ 'Side by Side',
9
+ 'Stacked',
10
+ 'Quad'
11
+ ];
12
+
13
+ // Cameras
14
+
15
+ export const cameras: Map<string, Camera> = new Map();
16
+ export const controls: Map<string, OrbitControls> = new Map();
17
+ export const helpers: Map<string, CameraHelper> = new Map();
18
+
19
+ export function createOrtho(name: string, position: Vector3) {
20
+ const camera = new OrthographicCamera(-100, 100, 100, -100, 50, 3000);
21
+ camera.name = name;
22
+ camera.position.copy(position);
23
+ camera.lookAt(0, 0, 0);
24
+ cameras.set(name, camera);
25
+ return camera;
26
+ }
27
+
28
+ createOrtho('Top', new Vector3(0, 1000, 0));
29
+ createOrtho('Bottom', new Vector3(0, -1000, 0));
30
+ createOrtho('Left', new Vector3(-1000, 0, 0));
31
+ createOrtho('Right', new Vector3(1000, 0, 0));
32
+ createOrtho('Front', new Vector3(0, 0, 1000));
33
+ createOrtho('Back', new Vector3(0, 0, -1000));
34
+ createOrtho('Orthographic', new Vector3(1000, 1000, 1000));
35
+
36
+ export const debugCamera = new PerspectiveCamera(60, 1, 50, 3000);
37
+ debugCamera.name = 'Debug';
38
+ debugCamera.position.set(500, 500, 500);
39
+ debugCamera.lookAt(0, 0, 0);
40
+ cameras.set('Debug', debugCamera);
41
+
42
+ // Rendering
43
+
44
+ export type RenderMode = 'Depth' | 'Normals' | 'Renderer' | 'UVs' | 'Wireframe';
45
+ export const renderOptions: RenderMode[] = [
46
+ 'Renderer',
47
+ 'Depth',
48
+ 'Normals',
49
+ 'UVs',
50
+ 'Wireframe',
51
+ ];
52
+ export const depthMaterial = new MeshDepthMaterial();
53
+ export const normalsMaterial = new MeshNormalMaterial();
54
+ export const uvMaterial = new UVMaterial();
55
+ export const wireframeMaterial = new MeshBasicMaterial({
56
+ opacity: 0.33,
57
+ transparent: true,
58
+ wireframe: true
59
+ });
@@ -0,0 +1,55 @@
1
+ import { ShaderMaterial } from "three";
2
+
3
+ const vertex = `#include <common>
4
+ #include <batching_pars_vertex>
5
+ #include <uv_pars_vertex>
6
+ #include <color_pars_vertex>
7
+ #include <morphtarget_pars_vertex>
8
+ #include <skinning_pars_vertex>
9
+ #include <logdepthbuf_pars_vertex>
10
+ #include <clipping_planes_pars_vertex>
11
+
12
+ void main() {
13
+ #include <uv_vertex>
14
+ #include <color_vertex>
15
+ #include <morphcolor_vertex>
16
+ #include <batching_vertex>
17
+
18
+ #if defined ( USE_SKINNING )
19
+ #include <beginnormal_vertex>
20
+ #include <morphnormal_vertex>
21
+ #include <skinbase_vertex>
22
+ #include <skinnormal_vertex>
23
+ #include <defaultnormal_vertex>
24
+ #endif
25
+
26
+ #include <begin_vertex>
27
+ #include <morphtarget_vertex>
28
+ #include <skinning_vertex>
29
+ #include <project_vertex>
30
+ #include <logdepthbuf_vertex>
31
+ #include <clipping_planes_vertex>
32
+ #include <worldpos_vertex>
33
+ }`;
34
+
35
+ const fragment = `
36
+ #include <common>
37
+ #include <uv_pars_fragment>
38
+ #include <clipping_planes_pars_fragment>
39
+
40
+ void main() {
41
+ #include <clipping_planes_fragment>
42
+ gl_FragColor = vec4(vec3(vUv, 0.0), 1.0);
43
+ }`;
44
+
45
+ export default class UVMaterial extends ShaderMaterial {
46
+ constructor() {
47
+ super({
48
+ defines: {
49
+ USE_UV: ''
50
+ },
51
+ vertexShader: vertex,
52
+ fragmentShader: fragment,
53
+ });
54
+ }
55
+ }
@@ -22,34 +22,24 @@ export default class SceneHierarchy extends Component<SceneHierarchyState> {
22
22
  debugDispatcher.addEventListener(ToolEvents.SET_SCENE, this.setScene);
23
23
  }
24
24
 
25
- componentDidMount(): void {
26
- this.onRefresh();
27
- }
28
-
29
25
  componentWillUnmount(): void {
30
26
  debugDispatcher.removeEventListener(ToolEvents.SET_SCENE, this.setScene);
31
27
  }
32
28
 
33
29
  render(): ReactNode {
34
30
  const hasScene = this.componentState.scene !== null;
35
- const HierarchyName = 'Hierarchy' + (hasScene ? `: ${this.componentState.scene?.name}` : '');
31
+ const HierarchyName = 'Hierarchy - ' + (hasScene ? `${this.componentState.scene?.name}` : 'No Scene');
36
32
  return (
37
33
  <div id="SceneHierarchy" key="SceneHierarchy">
38
34
  {(
39
35
  <>
40
- {hasScene && (
41
- <Accordion
42
- label={HierarchyName}
43
- button={(
44
- <button className='icon refresh hideText' onClick={this.onRefresh}>
45
- Refresh
46
- </button>
36
+ <Accordion label={HierarchyName} open={true}>
37
+ <>
38
+ {hasScene && (
39
+ <ContainerObject child={this.componentState.scene!} three={this.three} />
47
40
  )}
48
- open={true}
49
- >
50
- <ContainerObject child={this.componentState.scene!} three={this.three} />
51
- </Accordion>
52
- )}
41
+ </>
42
+ </Accordion>
53
43
 
54
44
  <Accordion label='Inspector'>
55
45
  <Inspector key="Inspector" three={this.three} />
@@ -62,10 +52,6 @@ export default class SceneHierarchy extends Component<SceneHierarchyState> {
62
52
 
63
53
  // Private
64
54
 
65
- private onRefresh = () => {
66
- this.three.getScene();
67
- };
68
-
69
55
  private setScene = (evt: any) => {
70
56
  this.setState(() => ({
71
57
  scene: evt.value
@@ -1,32 +1,42 @@
1
1
  import RemoteThree from "@/core/remote/RemoteThree";
2
2
  import { ToolEvents, debugDispatcher } from "@/editor/global";
3
3
  import { useEffect } from "react";
4
- import { Scene, Texture } from "three";
4
+ import { Texture } from "three";
5
5
  import { setItemProps, textureFromSrc } from "../utils";
6
6
 
7
7
  export interface SceneInspectorProps {
8
- scene: Scene
9
8
  three: RemoteThree
10
9
  }
11
10
 
12
11
  export default function SceneInspector(props: SceneInspectorProps) {
12
+ function hasScene() {
13
+ if (props.three.scene === undefined) {
14
+ console.log('No scene:', props.three);
15
+ return false;
16
+ }
17
+ return true;
18
+ }
13
19
  const onGetObject = (evt: any) => {
14
- const child = props.scene.getObjectByProperty('uuid', evt.value);
20
+ if (!hasScene()) return;
21
+ const child = props.three.scene?.getObjectByProperty('uuid', evt.value);
15
22
  if (child !== undefined) props.three.setObject(child);
16
23
  };
17
24
 
18
25
  const setChildProps = (uuid: string, key: string, value: any) => {
19
- const child = props.scene.getObjectByProperty('uuid', uuid);
26
+ if (!hasScene()) return;
27
+ const child = props.three.scene?.getObjectByProperty('uuid', uuid);
20
28
  if (child !== undefined) setItemProps(child, key, value);
21
29
  };
22
30
 
23
31
  const onUpdateObject = (evt: any) => {
32
+ if (!hasScene()) return;
24
33
  const msg = evt.value;
25
34
  const { key, value, uuid } = msg;
26
35
  setChildProps(uuid, key, value);
27
36
  };
28
37
 
29
38
  const onCreateTexture = (evt: any) => {
39
+ if (!hasScene()) return;
30
40
  const data = evt.value;
31
41
  textureFromSrc(data.value).then((texture: Texture) => {
32
42
  setChildProps(data.uuid, data.key, texture);
@@ -34,13 +44,10 @@ export default function SceneInspector(props: SceneInspectorProps) {
34
44
  });
35
45
  };
36
46
 
37
- const onGetScene = () => {
38
- props.three.setScene(props.scene);
39
- };
40
-
41
47
  const onRequestMethod = (evt: any) => {
48
+ if (!hasScene()) return;
42
49
  const { key, uuid, value } = evt.value;
43
- const child = props.scene.getObjectByProperty('uuid', uuid);
50
+ const child = props.three.scene?.getObjectByProperty('uuid', uuid);
44
51
  if (child !== undefined) {
45
52
  try {
46
53
  child[key](value);
@@ -55,13 +62,11 @@ export default function SceneInspector(props: SceneInspectorProps) {
55
62
 
56
63
  useEffect(() => {
57
64
  debugDispatcher.addEventListener(ToolEvents.GET_OBJECT, onGetObject);
58
- debugDispatcher.addEventListener(ToolEvents.GET_SCENE, onGetScene);
59
65
  debugDispatcher.addEventListener(ToolEvents.UPDATE_OBJECT, onUpdateObject);
60
66
  debugDispatcher.addEventListener(ToolEvents.CREATE_TEXTURE, onCreateTexture);
61
67
  debugDispatcher.addEventListener(ToolEvents.REQUEST_METHOD, onRequestMethod);
62
68
  return () => {
63
69
  debugDispatcher.removeEventListener(ToolEvents.GET_OBJECT, onGetObject);
64
- debugDispatcher.removeEventListener(ToolEvents.GET_SCENE, onGetScene);
65
70
  debugDispatcher.removeEventListener(ToolEvents.UPDATE_OBJECT, onUpdateObject);
66
71
  debugDispatcher.removeEventListener(ToolEvents.CREATE_TEXTURE, onCreateTexture);
67
72
  debugDispatcher.removeEventListener(ToolEvents.REQUEST_METHOD, onRequestMethod);
@@ -339,6 +339,7 @@ export function InspectMaterial(object: RemoteObject, three: RemoteThree): any {
339
339
  items.push(
340
340
  <InspectorGroup
341
341
  title={`Material ${i}`}
342
+ key={`Material ${i}`}
342
343
  items={inspectMaterialItems(material[i], object, three)}
343
344
  />
344
345
  );
@@ -1,8 +1,10 @@
1
1
  import { Euler, Matrix4, Vector3 } from 'three';
2
+ import { degToRad, radToDeg } from 'three/src/math/MathUtils';
2
3
  import InspectorGroup from '../InspectorGroup';
3
4
  import { RemoteObject } from "../../types";
4
5
  import RemoteThree from '@/core/remote/RemoteThree';
5
6
  import { setItemProps } from '../../utils';
7
+ import { round } from '@/editor/utils';
6
8
 
7
9
  export function InspectTransform(obj: RemoteObject, three: RemoteThree) {
8
10
  const matrix = new Matrix4();
@@ -22,73 +24,67 @@ export function InspectTransform(obj: RemoteObject, three: RemoteThree) {
22
24
  if (child !== undefined) setItemProps(child, prop, value);
23
25
  };
24
26
 
25
- const items: any[] = [
26
- {
27
- title: 'Position',
28
- items: [
27
+ const updateRotation = (prop: string, value: any) => {
28
+ updateTransform(prop, degToRad(value));
29
+ };
30
+
31
+ return (
32
+ <InspectorGroup
33
+ title="Transform"
34
+ items={[
29
35
  {
30
- title: 'X',
36
+ title: 'Position X',
31
37
  prop: 'position.x',
32
38
  type: 'number',
33
39
  value: position.x,
34
40
  onChange: updateTransform,
35
41
  },
36
42
  {
37
- title: 'Y',
43
+ title: 'Position Y',
38
44
  prop: 'position.y',
39
45
  type: 'number',
40
46
  value: position.y,
41
47
  onChange: updateTransform,
42
48
  },
43
49
  {
44
- title: 'Z',
50
+ title: 'Position Z',
45
51
  prop: 'position.z',
46
52
  type: 'number',
47
53
  value: position.z,
48
54
  onChange: updateTransform,
49
55
  },
50
- ],
51
- },
52
- {
53
- title: 'Rotation',
54
- items: [
55
56
  {
56
- title: 'X',
57
+ title: 'Rotation X',
57
58
  prop: 'rotation.x',
58
59
  type: 'number',
59
- value: rotation.x,
60
- min: -Math.PI,
61
- max: Math.PI,
62
- step: 0.01,
63
- onChange: updateTransform,
60
+ value: round(radToDeg(rotation.x)),
61
+ min: -360,
62
+ max: 360,
63
+ step: 0.1,
64
+ onChange: updateRotation,
64
65
  },
65
66
  {
66
- title: 'Y',
67
+ title: 'Rotation Y',
67
68
  prop: 'rotation.y',
68
69
  type: 'number',
69
- value: rotation.y,
70
- min: -Math.PI,
71
- max: Math.PI,
72
- step: 0.01,
73
- onChange: updateTransform,
70
+ value: round(radToDeg(rotation.y)),
71
+ min: -360,
72
+ max: 360,
73
+ step: 0.1,
74
+ onChange: updateRotation,
74
75
  },
75
76
  {
76
- title: 'Z',
77
+ title: 'Rotation Z',
77
78
  prop: 'rotation.z',
78
79
  type: 'number',
79
- value: rotation.z,
80
- min: -Math.PI,
81
- max: Math.PI,
82
- step: 0.01,
83
- onChange: updateTransform,
80
+ value: round(radToDeg(rotation.z)),
81
+ min: -360,
82
+ max: 360,
83
+ step: 0.1,
84
+ onChange: updateRotation,
84
85
  },
85
- ],
86
- },
87
- {
88
- title: 'Scale',
89
- items: [
90
86
  {
91
- title: 'X',
87
+ title: 'Scale X',
92
88
  prop: 'scale.x',
93
89
  type: 'number',
94
90
  value: scale.x,
@@ -96,7 +92,7 @@ export function InspectTransform(obj: RemoteObject, three: RemoteThree) {
96
92
  onChange: updateTransform,
97
93
  },
98
94
  {
99
- title: 'Y',
95
+ title: 'Scale Y',
100
96
  prop: 'scale.y',
101
97
  type: 'number',
102
98
  value: scale.y,
@@ -104,21 +100,14 @@ export function InspectTransform(obj: RemoteObject, three: RemoteThree) {
104
100
  onChange: updateTransform,
105
101
  },
106
102
  {
107
- title: 'Z',
103
+ title: 'Scale Z',
108
104
  prop: 'scale.z',
109
105
  type: 'number',
110
106
  value: scale.z,
111
107
  step: 0.01,
112
108
  onChange: updateTransform,
113
109
  },
114
- ],
115
- },
116
- ];
117
-
118
- return (
119
- <InspectorGroup
120
- title="Transform"
121
- items={items}
110
+ ]}
122
111
  />
123
112
  );
124
113
  }
@@ -1,4 +1,4 @@
1
- import { Object3D } from "three";
1
+ import { Material, Mesh, Object3D, PositionalAudio, Texture } from "three";
2
2
 
3
3
  export function clamp(min: number, max: number, value: number) {
4
4
  return Math.min(max, Math.max(min, value));
@@ -38,20 +38,76 @@ export function colorToHex(obj: any) {
38
38
  return '#' + red + green + blue;
39
39
  }
40
40
 
41
- let totalObjects = 0;
41
+ export function round(value: number, precision: number = 1): number {
42
+ return Number(value.toFixed(precision));
43
+ }
44
+
45
+ export let totalThreeObjects = 0;
46
+ export const resetThreeObjects = () => {
47
+ totalThreeObjects = 0;
48
+ };
42
49
  export const hierarchyUUID = (object: Object3D): void => {
43
50
  if (!object) return;
44
51
 
45
52
  let uuid = object.name.replace(' ', '');
46
53
  // fallback in case there's no name
47
- if (uuid.length === 0) uuid = `obj_${totalObjects}`;
54
+ if (uuid.length === 0) {
55
+ uuid = `obj_${totalThreeObjects}`;
56
+ totalThreeObjects++;
57
+ }
48
58
  // inherit parent's UUID for hierarchy
49
59
  if (object.parent !== null) uuid = `${object.parent.uuid}.${uuid}`;
50
60
  object.uuid = uuid;
51
- totalObjects++;
52
61
 
53
62
  // Iterate children
54
63
  object.children.forEach((child: Object3D) => {
55
64
  hierarchyUUID(child);
56
65
  });
57
66
  };
67
+
68
+ // Dispose
69
+
70
+ export const disposeTexture = (texture?: Texture): void => {
71
+ texture?.dispose();
72
+ };
73
+
74
+ // Dispose material
75
+ export const disposeMaterial = (material?: Material | Material[]): void => {
76
+ if (!material) return;
77
+
78
+ if (Array.isArray(material)) {
79
+ material.forEach((mat: Material) => mat.dispose());
80
+ } else {
81
+ material.dispose();
82
+ }
83
+ };
84
+
85
+ // Dispose object
86
+ export const dispose = (object: Object3D): void => {
87
+ if (!object) return;
88
+
89
+ // Dispose children
90
+ while (object.children.length > 0) {
91
+ const child = object.children[0];
92
+ if (child instanceof PositionalAudio) {
93
+ child.pause();
94
+ if (child.parent) {
95
+ child.parent.remove(child);
96
+ }
97
+ } else {
98
+ dispose(child);
99
+ }
100
+ }
101
+
102
+ // Dispose object
103
+ if (object.parent) object.parent.remove(object);
104
+ // @ts-ignore
105
+ if (object.isMesh) {
106
+ const mesh = object as Mesh;
107
+ mesh.geometry?.dispose();
108
+ disposeMaterial(mesh.material);
109
+ }
110
+
111
+ // @ts-ignore
112
+ if (object.dispose !== undefined) object.dispose();
113
+ };
package/src/index.ts CHANGED
@@ -15,12 +15,13 @@ export { default as DropdownItem } from './editor/components/DropdownItem';
15
15
  export { default as Dropdown } from './editor/components/Dropdown';
16
16
  export { default as RemoteController } from './core/RemoteController';
17
17
  // RemoteThree
18
+ export { default as InfiniteGridHelper } from './editor/multiView/InfiniteGridHelper';
19
+ export { default as UVMaterial } from './editor/multiView/UVMaterial';
18
20
  export { default as SceneHierarchy } from './editor/sceneHierarchy/SceneHierarchy';
19
21
  export { default as Accordion } from './editor/sceneHierarchy/Accordion';
20
22
  export { default as ChildObject } from './editor/sceneHierarchy/ChildObject';
21
23
  export { default as ContainerObject } from './editor/sceneHierarchy/ContainerObject';
22
24
  export { default as Inspector } from './editor/sceneHierarchy/inspector/Inspector';
23
25
  export { default as SceneInspector } from './editor/sceneHierarchy/inspector/SceneInspector';
24
- export { default as MultiView } from './editor/sceneHierarchy/inspector/MultiView/MultiView';
25
- export { default as InfiniteGridHelper } from './editor/sceneHierarchy/inspector/MultiView/InfiniteGridHelper';
26
+ export { default as MultiView } from './editor/multiView/MultiView';
26
27
  export { default as Editor } from './editor/Editor';
@@ -7,6 +7,5 @@ export default class RemoteThree extends BaseRemote {
7
7
  requestMethod(uuid: string, key: string, value?: any): void;
8
8
  updateObject(uuid: string, key: string, value: any): void;
9
9
  createTexture(uuid: string, key: string, value: any): void;
10
- getScene(): void;
11
10
  setScene(value: Scene): void;
12
11
  }
@@ -6,7 +6,7 @@ export interface BroadcastData {
6
6
  export type ApplicationMode = 'app' | 'editor';
7
7
  export type VoidCallback = () => void;
8
8
  export type DataUpdateCallback = (data: any) => void;
9
- export type EditorEvent = 'custom' | 'setSheet' | 'setSheetObject' | 'updateSheetObject' | 'updateTimeline' | 'getObject' | 'setObject' | 'updateObject' | 'getScene' | 'setScene' | 'createTexture' | 'requestMethod' | 'addFolder' | 'bindObject' | 'updateBind' | 'addButton' | 'clickButton' | 'selectComponent' | 'draggableListUpdate';
9
+ export type EditorEvent = 'custom' | 'setSheet' | 'setSheetObject' | 'updateSheetObject' | 'updateTimeline' | 'getObject' | 'setObject' | 'updateObject' | 'setScene' | 'createTexture' | 'requestMethod' | 'addFolder' | 'bindObject' | 'updateBind' | 'addButton' | 'clickButton' | 'selectComponent' | 'draggableListUpdate';
10
10
  export type VoidFunc = () => void;
11
11
  export type BroadcastCallback = (data: BroadcastData) => void;
12
12
  export type TheatreUpdateCallback = (data: any) => void;
@@ -4,7 +4,6 @@ export declare const ToolEvents: {
4
4
  CUSTOM: string;
5
5
  SELECT_DROPDOWN: string;
6
6
  DRAG_UPDATE: string;
7
- GET_SCENE: string;
8
7
  SET_SCENE: string;
9
8
  GET_OBJECT: string;
10
9
  SET_OBJECT: string;
@@ -0,0 +1,9 @@
1
+ import { MultiViewMode } from './MultiViewData';
2
+ import './MultiView.scss';
3
+ import RemoteThree from '@/core/remote/RemoteThree';
4
+ interface MultiViewProps {
5
+ three: RemoteThree;
6
+ mode?: MultiViewMode;
7
+ }
8
+ export default function MultiView(props: MultiViewProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,16 @@
1
+ import { Camera, CameraHelper, MeshBasicMaterial, MeshDepthMaterial, MeshNormalMaterial, OrthographicCamera, PerspectiveCamera, Vector3 } from 'three';
2
+ import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
3
+ import UVMaterial from './UVMaterial';
4
+ export type MultiViewMode = 'Single' | 'Side by Side' | 'Stacked' | 'Quad';
5
+ export declare const ModeOptions: MultiViewMode[];
6
+ export declare const cameras: Map<string, Camera>;
7
+ export declare const controls: Map<string, OrbitControls>;
8
+ export declare const helpers: Map<string, CameraHelper>;
9
+ export declare function createOrtho(name: string, position: Vector3): OrthographicCamera;
10
+ export declare const debugCamera: PerspectiveCamera;
11
+ export type RenderMode = 'Depth' | 'Normals' | 'Renderer' | 'UVs' | 'Wireframe';
12
+ export declare const renderOptions: RenderMode[];
13
+ export declare const depthMaterial: MeshDepthMaterial;
14
+ export declare const normalsMaterial: MeshNormalMaterial;
15
+ export declare const uvMaterial: UVMaterial;
16
+ export declare const wireframeMaterial: MeshBasicMaterial;
@@ -0,0 +1,4 @@
1
+ import { ShaderMaterial } from "three";
2
+ export default class UVMaterial extends ShaderMaterial {
3
+ constructor();
4
+ }
@@ -4,10 +4,8 @@ import { SceneHierarchyState } from './types';
4
4
  export default class SceneHierarchy extends Component<SceneHierarchyState> {
5
5
  private three;
6
6
  constructor(props: SceneHierarchyState);
7
- componentDidMount(): void;
8
7
  componentWillUnmount(): void;
9
8
  render(): ReactNode;
10
- private onRefresh;
11
9
  private setScene;
12
10
  get componentState(): SceneHierarchyState;
13
11
  }
@@ -1,7 +1,5 @@
1
1
  import RemoteThree from "@/core/remote/RemoteThree";
2
- import { Scene } from "three";
3
2
  export interface SceneInspectorProps {
4
- scene: Scene;
5
3
  three: RemoteThree;
6
4
  }
7
5
  export default function SceneInspector(props: SceneInspectorProps): null;
@@ -1,7 +1,13 @@
1
- import { Object3D } from "three";
1
+ import { Material, Object3D, Texture } from "three";
2
2
  export declare function clamp(min: number, max: number, value: number): number;
3
3
  export declare function distance(x: number, y: number): number;
4
4
  export declare function randomID(): string;
5
5
  export declare function isColor(obj: any): boolean;
6
6
  export declare function colorToHex(obj: any): string;
7
+ export declare function round(value: number, precision?: number): number;
8
+ export declare let totalThreeObjects: number;
9
+ export declare const resetThreeObjects: () => void;
7
10
  export declare const hierarchyUUID: (object: Object3D) => void;
11
+ export declare const disposeTexture: (texture?: Texture) => void;
12
+ export declare const disposeMaterial: (material?: Material | Material[]) => void;
13
+ export declare const dispose: (object: Object3D) => void;
package/types/index.d.ts CHANGED
@@ -12,12 +12,13 @@ export { default as Draggable } from './editor/components/Draggable';
12
12
  export { default as DropdownItem } from './editor/components/DropdownItem';
13
13
  export { default as Dropdown } from './editor/components/Dropdown';
14
14
  export { default as RemoteController } from './core/RemoteController';
15
+ export { default as InfiniteGridHelper } from './editor/multiView/InfiniteGridHelper';
16
+ export { default as UVMaterial } from './editor/multiView/UVMaterial';
15
17
  export { default as SceneHierarchy } from './editor/sceneHierarchy/SceneHierarchy';
16
18
  export { default as Accordion } from './editor/sceneHierarchy/Accordion';
17
19
  export { default as ChildObject } from './editor/sceneHierarchy/ChildObject';
18
20
  export { default as ContainerObject } from './editor/sceneHierarchy/ContainerObject';
19
21
  export { default as Inspector } from './editor/sceneHierarchy/inspector/Inspector';
20
22
  export { default as SceneInspector } from './editor/sceneHierarchy/inspector/SceneInspector';
21
- export { default as MultiView } from './editor/sceneHierarchy/inspector/MultiView/MultiView';
22
- export { default as InfiniteGridHelper } from './editor/sceneHierarchy/inspector/MultiView/InfiniteGridHelper';
23
+ export { default as MultiView } from './editor/multiView/MultiView';
23
24
  export { default as Editor } from './editor/Editor';
@@ -1,11 +0,0 @@
1
- import { Camera, Scene, WebGLRenderer } from 'three';
2
- import './MultiView.scss';
3
- type MultiViewMode = 'Single' | 'Side by Side' | 'Stacked' | 'Quad';
4
- interface MultiViewProps {
5
- scene: Scene;
6
- renderer: WebGLRenderer;
7
- cameras: Camera[];
8
- mode?: MultiViewMode;
9
- }
10
- export default function MultiView(props: MultiViewProps): import("react/jsx-runtime").JSX.Element;
11
- export {};