@tomorrowevening/hermes 0.0.8 → 0.0.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.js +1546 -1490
- package/dist/hermes.umd.cjs +52 -14
- package/package.json +3 -1
- package/src/editor/sceneHierarchy/inspector/MultiView/MultiView.tsx +13 -69
- package/src/editor/sceneHierarchy/inspector/MultiView/MultiViewData.ts +67 -0
- package/src/editor/sceneHierarchy/inspector/MultiView/UVMaterial.ts +55 -0
- package/src/index.ts +2 -1
- package/types/editor/sceneHierarchy/inspector/MultiView/MultiView.d.ts +1 -1
- package/types/editor/sceneHierarchy/inspector/MultiView/MultiViewData.d.ts +16 -0
- package/types/editor/sceneHierarchy/inspector/MultiView/UVMaterial.d.ts +4 -0
- package/types/index.d.ts +2 -1
@@ -1,69 +1,25 @@
|
|
1
1
|
import { useEffect, useRef, useState } from 'react';
|
2
|
-
import { AxesHelper, Camera, CameraHelper,
|
2
|
+
import { AxesHelper, Camera, CameraHelper, OrthographicCamera, PerspectiveCamera, Scene, Vector2, WebGLRenderer } from 'three';
|
3
3
|
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
|
4
4
|
import CameraWindow, { Dropdown } from './CameraWindow';
|
5
5
|
import InfiniteGridHelper from './InfiniteGridHelper';
|
6
|
+
import { cameraOptions, cameras, controls, helpers, ModeOptions, MultiViewMode, normalsMaterial, RenderMode, renderOptions, uvMaterial, wireframeMaterial } from './MultiViewData';
|
6
7
|
import './MultiView.scss';
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
let currentRenderMode: RenderMode = 'Default';
|
10
|
+
|
11
|
+
const scene = new Scene();
|
12
|
+
let tlCam = cameras.get('Debug')!;
|
13
|
+
let trCam = cameras.get('Orthographic')!;
|
14
|
+
let blCam = cameras.get('Front')!;
|
15
|
+
let brCam = cameras.get('Top')!;
|
16
|
+
|
15
17
|
interface MultiViewProps {
|
16
18
|
scene: Scene;
|
17
19
|
renderer: WebGLRenderer;
|
18
20
|
cameras: Camera[];
|
19
21
|
mode?: MultiViewMode;
|
20
22
|
}
|
21
|
-
|
22
|
-
const cameras: Map<string, Camera> = new Map();
|
23
|
-
const controls: Map<string, OrbitControls> = new Map();
|
24
|
-
const helpers: Map<string, CameraHelper> = new Map();
|
25
|
-
|
26
|
-
function createOrtho(name: string, position: Vector3) {
|
27
|
-
const camera = new OrthographicCamera(-100, 100, 100, -100, 50, 3000);
|
28
|
-
camera.name = name;
|
29
|
-
camera.position.copy(position);
|
30
|
-
camera.lookAt(0, 0, 0);
|
31
|
-
cameras.set(name, camera);
|
32
|
-
return camera;
|
33
|
-
}
|
34
|
-
|
35
|
-
// Cameras
|
36
|
-
|
37
|
-
createOrtho('Top', new Vector3(0, 1000, 0));
|
38
|
-
createOrtho('Bottom', new Vector3(0, -1000, 0));
|
39
|
-
createOrtho('Left', new Vector3(-1000, 0, 0));
|
40
|
-
createOrtho('Right', new Vector3(1000, 0, 0));
|
41
|
-
createOrtho('Front', new Vector3(0, 0, 1000));
|
42
|
-
createOrtho('Back', new Vector3(0, 0, -1000));
|
43
|
-
createOrtho('Orthographic', new Vector3(1000, 1000, 1000));
|
44
|
-
|
45
|
-
const debugCamera = new PerspectiveCamera(60, 1, 50, 3000);
|
46
|
-
debugCamera.name = 'Debug';
|
47
|
-
debugCamera.position.set(500, 500, 500);
|
48
|
-
debugCamera.lookAt(0, 0, 0);
|
49
|
-
cameras.set('Debug', debugCamera);
|
50
|
-
|
51
|
-
type RenderMode = 'Default' | 'Normals' | 'Wireframe';
|
52
|
-
let currentRenderMode: RenderMode = 'Default';
|
53
|
-
const renderOptions: RenderMode[] = [
|
54
|
-
'Default',
|
55
|
-
'Normals',
|
56
|
-
'Wireframe',
|
57
|
-
];
|
58
|
-
const normalsMaterial = new MeshNormalMaterial();
|
59
|
-
const wireframeMaterial = new MeshBasicMaterial({
|
60
|
-
opacity: 0.33,
|
61
|
-
transparent: true,
|
62
|
-
wireframe: true
|
63
|
-
});
|
64
|
-
|
65
|
-
const scene = new Scene();
|
66
|
-
|
67
23
|
export default function MultiView(props: MultiViewProps) {
|
68
24
|
const [mode, setMode] = useState<MultiViewMode>(props.mode !== undefined ? props.mode : 'Quad');
|
69
25
|
|
@@ -72,11 +28,6 @@ export default function MultiView(props: MultiViewProps) {
|
|
72
28
|
const blWindow = useRef<HTMLDivElement>(null);
|
73
29
|
const brWindow = useRef<HTMLDivElement>(null);
|
74
30
|
|
75
|
-
let tlCam = cameras.get('Debug')!;
|
76
|
-
let trCam = cameras.get('Orthographic')!;
|
77
|
-
let blCam = cameras.get('Front')!;
|
78
|
-
let brCam = cameras.get('Top')!;
|
79
|
-
|
80
31
|
const createControls = (camera: Camera, element: HTMLDivElement) => {
|
81
32
|
// Previous items
|
82
33
|
const prevControls = controls.get(camera.name);
|
@@ -316,16 +267,6 @@ export default function MultiView(props: MultiViewProps) {
|
|
316
267
|
};
|
317
268
|
}, [mode]);
|
318
269
|
|
319
|
-
const cameraOptions: string[] = [
|
320
|
-
'Top',
|
321
|
-
'Bottom',
|
322
|
-
'Left',
|
323
|
-
'Right',
|
324
|
-
'Front',
|
325
|
-
'Back',
|
326
|
-
'Orthographic',
|
327
|
-
'Debug',
|
328
|
-
];
|
329
270
|
props.cameras.forEach((camera: Camera) => {
|
330
271
|
cameras.set(camera.name, camera);
|
331
272
|
cameraOptions.push(camera.name);
|
@@ -441,6 +382,9 @@ export default function MultiView(props: MultiViewProps) {
|
|
441
382
|
case 'Wireframe':
|
442
383
|
scene.overrideMaterial = wireframeMaterial;
|
443
384
|
break;
|
385
|
+
case 'UVs':
|
386
|
+
scene.overrideMaterial = uvMaterial;
|
387
|
+
break;
|
444
388
|
}
|
445
389
|
}}
|
446
390
|
/>
|
@@ -0,0 +1,67 @@
|
|
1
|
+
import { Camera, CameraHelper, MeshBasicMaterial, 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
|
+
export const cameraOptions: string[] = [
|
19
|
+
'Top',
|
20
|
+
'Bottom',
|
21
|
+
'Left',
|
22
|
+
'Right',
|
23
|
+
'Front',
|
24
|
+
'Back',
|
25
|
+
'Orthographic',
|
26
|
+
'Debug',
|
27
|
+
];
|
28
|
+
|
29
|
+
export function createOrtho(name: string, position: Vector3) {
|
30
|
+
const camera = new OrthographicCamera(-100, 100, 100, -100, 50, 3000);
|
31
|
+
camera.name = name;
|
32
|
+
camera.position.copy(position);
|
33
|
+
camera.lookAt(0, 0, 0);
|
34
|
+
cameras.set(name, camera);
|
35
|
+
return camera;
|
36
|
+
}
|
37
|
+
|
38
|
+
createOrtho('Top', new Vector3(0, 1000, 0));
|
39
|
+
createOrtho('Bottom', new Vector3(0, -1000, 0));
|
40
|
+
createOrtho('Left', new Vector3(-1000, 0, 0));
|
41
|
+
createOrtho('Right', new Vector3(1000, 0, 0));
|
42
|
+
createOrtho('Front', new Vector3(0, 0, 1000));
|
43
|
+
createOrtho('Back', new Vector3(0, 0, -1000));
|
44
|
+
createOrtho('Orthographic', new Vector3(1000, 1000, 1000));
|
45
|
+
|
46
|
+
export const debugCamera = new PerspectiveCamera(60, 1, 50, 3000);
|
47
|
+
debugCamera.name = 'Debug';
|
48
|
+
debugCamera.position.set(500, 500, 500);
|
49
|
+
debugCamera.lookAt(0, 0, 0);
|
50
|
+
cameras.set('Debug', debugCamera);
|
51
|
+
|
52
|
+
// Rendering
|
53
|
+
|
54
|
+
export type RenderMode = 'Default' | 'Normals' | 'Wireframe' | 'UVs';
|
55
|
+
export const renderOptions: RenderMode[] = [
|
56
|
+
'Default',
|
57
|
+
'Normals',
|
58
|
+
'Wireframe',
|
59
|
+
'UVs',
|
60
|
+
];
|
61
|
+
export const normalsMaterial = new MeshNormalMaterial();
|
62
|
+
export const wireframeMaterial = new MeshBasicMaterial({
|
63
|
+
opacity: 0.33,
|
64
|
+
transparent: true,
|
65
|
+
wireframe: true
|
66
|
+
});
|
67
|
+
export const uvMaterial = new UVMaterial();
|
@@ -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
|
+
}
|
package/src/index.ts
CHANGED
@@ -15,6 +15,8 @@ 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/sceneHierarchy/inspector/MultiView/InfiniteGridHelper';
|
19
|
+
export { default as UVMaterial } from './editor/sceneHierarchy/inspector/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';
|
@@ -22,5 +24,4 @@ export { default as ContainerObject } from './editor/sceneHierarchy/ContainerObj
|
|
22
24
|
export { default as Inspector } from './editor/sceneHierarchy/inspector/Inspector';
|
23
25
|
export { default as SceneInspector } from './editor/sceneHierarchy/inspector/SceneInspector';
|
24
26
|
export { default as MultiView } from './editor/sceneHierarchy/inspector/MultiView/MultiView';
|
25
|
-
export { default as InfiniteGridHelper } from './editor/sceneHierarchy/inspector/MultiView/InfiniteGridHelper';
|
26
27
|
export { default as Editor } from './editor/Editor';
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Camera, Scene, WebGLRenderer } from 'three';
|
2
|
+
import { MultiViewMode } from './MultiViewData';
|
2
3
|
import './MultiView.scss';
|
3
|
-
type MultiViewMode = 'Single' | 'Side by Side' | 'Stacked' | 'Quad';
|
4
4
|
interface MultiViewProps {
|
5
5
|
scene: Scene;
|
6
6
|
renderer: WebGLRenderer;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { Camera, CameraHelper, MeshBasicMaterial, 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 const cameraOptions: string[];
|
10
|
+
export declare function createOrtho(name: string, position: Vector3): OrthographicCamera;
|
11
|
+
export declare const debugCamera: PerspectiveCamera;
|
12
|
+
export type RenderMode = 'Default' | 'Normals' | 'Wireframe' | 'UVs';
|
13
|
+
export declare const renderOptions: RenderMode[];
|
14
|
+
export declare const normalsMaterial: MeshNormalMaterial;
|
15
|
+
export declare const wireframeMaterial: MeshBasicMaterial;
|
16
|
+
export declare const uvMaterial: UVMaterial;
|
package/types/index.d.ts
CHANGED
@@ -12,6 +12,8 @@ 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/sceneHierarchy/inspector/MultiView/InfiniteGridHelper';
|
16
|
+
export { default as UVMaterial } from './editor/sceneHierarchy/inspector/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';
|
@@ -19,5 +21,4 @@ export { default as ContainerObject } from './editor/sceneHierarchy/ContainerObj
|
|
19
21
|
export { default as Inspector } from './editor/sceneHierarchy/inspector/Inspector';
|
20
22
|
export { default as SceneInspector } from './editor/sceneHierarchy/inspector/SceneInspector';
|
21
23
|
export { default as MultiView } from './editor/sceneHierarchy/inspector/MultiView/MultiView';
|
22
|
-
export { default as InfiniteGridHelper } from './editor/sceneHierarchy/inspector/MultiView/InfiniteGridHelper';
|
23
24
|
export { default as Editor } from './editor/Editor';
|