@tomorrowevening/hermes 0.0.37 → 0.0.39
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 +15 -15
- package/dist/hermes.esm.js +809 -811
- package/package.json +1 -5
- package/types/core/Application.d.ts +5 -4
- package/types/core/remote/BaseRemote.d.ts +4 -0
- package/types/core/remote/RemoteComponents.d.ts +1 -2
- package/types/core/remote/RemoteTheatre.d.ts +3 -4
- package/types/core/remote/RemoteThree.d.ts +2 -3
- package/types/core/remote/RemoteTweakpane.d.ts +1 -1
- package/types/editor/sidePanel/SidePanel.d.ts +1 -9
- package/dist/hermes.umd.js +0 -144
- package/src/core/Application.ts +0 -111
- package/src/core/RemoteController.ts +0 -60
- package/src/core/remote/BaseRemote.ts +0 -16
- package/src/core/remote/RemoteComponents.ts +0 -45
- package/src/core/remote/RemoteTheatre.ts +0 -300
- package/src/core/remote/RemoteThree.ts +0 -143
- package/src/core/remote/RemoteTweakpane.ts +0 -194
- package/src/core/types.ts +0 -56
- package/src/editor/Editor.tsx +0 -20
- package/src/editor/components/Draggable.tsx +0 -40
- package/src/editor/components/DraggableItem.tsx +0 -22
- package/src/editor/components/Dropdown.tsx +0 -38
- package/src/editor/components/DropdownItem.tsx +0 -64
- package/src/editor/components/NavButton.tsx +0 -11
- package/src/editor/components/content.ts +0 -2
- package/src/editor/components/icons/CloseIcon.tsx +0 -7
- package/src/editor/components/icons/DragIcon.tsx +0 -9
- package/src/editor/components/types.ts +0 -41
- package/src/editor/global.ts +0 -20
- package/src/editor/multiView/CameraWindow.tsx +0 -74
- package/src/editor/multiView/InfiniteGridHelper.ts +0 -24
- package/src/editor/multiView/InfiniteGridMaterial.ts +0 -127
- package/src/editor/multiView/MultiView.scss +0 -101
- package/src/editor/multiView/MultiView.tsx +0 -636
- package/src/editor/multiView/MultiViewData.ts +0 -59
- package/src/editor/multiView/UVMaterial.ts +0 -55
- package/src/editor/scss/_debug.scss +0 -58
- package/src/editor/scss/_draggable.scss +0 -43
- package/src/editor/scss/_dropdown.scss +0 -84
- package/src/editor/scss/_sidePanel.scss +0 -278
- package/src/editor/scss/_theme.scss +0 -9
- package/src/editor/scss/index.scss +0 -67
- package/src/editor/sidePanel/Accordion.tsx +0 -41
- package/src/editor/sidePanel/ChildObject.tsx +0 -57
- package/src/editor/sidePanel/ContainerObject.tsx +0 -11
- package/src/editor/sidePanel/SidePanel.tsx +0 -64
- package/src/editor/sidePanel/ToggleBtn.tsx +0 -27
- package/src/editor/sidePanel/inspector/Inspector.tsx +0 -119
- package/src/editor/sidePanel/inspector/InspectorField.tsx +0 -198
- package/src/editor/sidePanel/inspector/InspectorGroup.tsx +0 -50
- package/src/editor/sidePanel/inspector/SceneInspector.tsx +0 -84
- package/src/editor/sidePanel/inspector/inspector.scss +0 -161
- package/src/editor/sidePanel/inspector/utils/InspectAnimation.tsx +0 -102
- package/src/editor/sidePanel/inspector/utils/InspectCamera.tsx +0 -75
- package/src/editor/sidePanel/inspector/utils/InspectLight.tsx +0 -62
- package/src/editor/sidePanel/inspector/utils/InspectMaterial.tsx +0 -710
- package/src/editor/sidePanel/inspector/utils/InspectTransform.tsx +0 -113
- package/src/editor/sidePanel/types.ts +0 -130
- package/src/editor/sidePanel/utils.ts +0 -278
- package/src/editor/utils.ts +0 -117
- package/src/example/CustomEditor.tsx +0 -78
- package/src/example/components/App.css +0 -6
- package/src/example/components/App.tsx +0 -246
- package/src/example/constants.ts +0 -52
- package/src/example/index.scss +0 -45
- package/src/example/main.tsx +0 -37
- package/src/example/three/BaseScene.ts +0 -42
- package/src/example/three/CustomMaterial.ts +0 -72
- package/src/example/three/FBXAnimation.ts +0 -26
- package/src/example/three/Scene1.ts +0 -225
- package/src/example/three/Scene2.ts +0 -138
- package/src/example/three/loader.ts +0 -110
- package/src/index.ts +0 -27
- package/src/vite-env.d.ts +0 -1
@@ -1,225 +0,0 @@
|
|
1
|
-
import { BackSide, CircleGeometry, DirectionalLight, HemisphereLight, Mesh, MeshBasicMaterial, MeshMatcapMaterial, MeshPhongMaterial, MeshPhysicalMaterial, Object3D, SphereGeometry, SpotLight, WebGLRenderer } from 'three';
|
2
|
-
import { BlendFunction, EffectComposer, EffectPass, FXAAEffect, NoiseEffect, RenderPass, TiltShiftEffect, VignetteEffect } from 'postprocessing';
|
3
|
-
import CustomMaterial from './CustomMaterial';
|
4
|
-
import { hierarchyUUID } from '../../editor/utils';
|
5
|
-
import { IS_DEV, app } from '../constants';
|
6
|
-
import FBXAnimation from './FBXAnimation';
|
7
|
-
import { cubeTextures, textures } from './loader';
|
8
|
-
import BaseScene from './BaseScene';
|
9
|
-
|
10
|
-
export default class Scene1 extends BaseScene {
|
11
|
-
dance!: FBXAnimation;
|
12
|
-
|
13
|
-
private customMat!: CustomMaterial;
|
14
|
-
private post!: EffectComposer;
|
15
|
-
|
16
|
-
constructor(renderer: WebGLRenderer) {
|
17
|
-
super(renderer);
|
18
|
-
this.name = 'Scene1';
|
19
|
-
const envMap = cubeTextures.get('environment')!;
|
20
|
-
this.background = envMap;
|
21
|
-
|
22
|
-
if (app.editor) {
|
23
|
-
const bg = new Mesh(new SphereGeometry(), new MeshBasicMaterial({ envMap: envMap, side: BackSide }));
|
24
|
-
bg.name = 'bg';
|
25
|
-
bg.scale.setScalar(1000);
|
26
|
-
this.add(bg);
|
27
|
-
}
|
28
|
-
|
29
|
-
this.createLights();
|
30
|
-
this.createWorld();
|
31
|
-
if (!app.editor) this.createPost();
|
32
|
-
this.createAnimation();
|
33
|
-
if (IS_DEV) hierarchyUUID(this);
|
34
|
-
}
|
35
|
-
|
36
|
-
private createLights() {
|
37
|
-
const lights = new Object3D();
|
38
|
-
lights.name = 'lights';
|
39
|
-
this.add(lights);
|
40
|
-
|
41
|
-
const sun = new DirectionalLight(0xffffff, 0.25);
|
42
|
-
sun.name = 'sun';
|
43
|
-
sun.castShadow = true;
|
44
|
-
sun.position.set(0, 50, 50);
|
45
|
-
const shadow = 256;
|
46
|
-
sun.shadow.camera.top = shadow;
|
47
|
-
sun.shadow.camera.bottom = -shadow;
|
48
|
-
sun.shadow.camera.left = - shadow;
|
49
|
-
sun.shadow.camera.right = shadow;
|
50
|
-
sun.shadow.mapSize.width = 1024;
|
51
|
-
sun.shadow.mapSize.height = 1024;
|
52
|
-
sun.shadow.camera.near = 10;
|
53
|
-
sun.shadow.camera.far = 1000;
|
54
|
-
sun.shadow.bias = 0.0001;
|
55
|
-
lights.add(sun);
|
56
|
-
|
57
|
-
const hemi = new HemisphereLight(0x6fb4e2, 0xc46d27, 0.5);
|
58
|
-
hemi.name = 'hemi';
|
59
|
-
lights.add(hemi);
|
60
|
-
|
61
|
-
const spotlight = new SpotLight(0xffffff, 3);
|
62
|
-
spotlight.angle = 5.8;
|
63
|
-
spotlight.decay = 0;
|
64
|
-
spotlight.distance = 1000;
|
65
|
-
spotlight.penumbra = Math.PI;
|
66
|
-
spotlight.name = 'spotlight';
|
67
|
-
spotlight.castShadow = true;
|
68
|
-
spotlight.position.set(-50, 200, 200);
|
69
|
-
spotlight.lookAt(0, 50, 0);
|
70
|
-
lights.add(spotlight);
|
71
|
-
}
|
72
|
-
|
73
|
-
private createWorld() {
|
74
|
-
const world = new Object3D();
|
75
|
-
world.name = 'world';
|
76
|
-
this.add(world);
|
77
|
-
|
78
|
-
const gridTexture = textures.get('uv_grid')!;
|
79
|
-
gridTexture.repeat.setScalar(10);
|
80
|
-
gridTexture.needsUpdate = true;
|
81
|
-
const floorMaterial = new MeshPhongMaterial({ map: gridTexture });
|
82
|
-
const floor = new Mesh(new CircleGeometry(500, 36), floorMaterial);
|
83
|
-
floor.name = 'floor';
|
84
|
-
floor.receiveShadow = true;
|
85
|
-
floor.rotateX(-Math.PI / 2);
|
86
|
-
world.add(floor);
|
87
|
-
|
88
|
-
this.dance = new FBXAnimation('Flair');
|
89
|
-
this.dance.position.set(0, 0, 0);
|
90
|
-
world.add(this.dance);
|
91
|
-
|
92
|
-
this.createTestMaterials(world);
|
93
|
-
}
|
94
|
-
|
95
|
-
private createTestMaterials(world: Object3D) {
|
96
|
-
const geom = new SphereGeometry(20);
|
97
|
-
|
98
|
-
const items: Mesh[] = [];
|
99
|
-
const mesh = new Mesh(geom, new MeshBasicMaterial({ name: 'BasicMaterial', transparent: true }));
|
100
|
-
mesh.name = 'Basic';
|
101
|
-
world.add(mesh);
|
102
|
-
items.push(mesh);
|
103
|
-
|
104
|
-
const mesh2 = new Mesh(geom, new MeshMatcapMaterial({ transparent: true }));
|
105
|
-
mesh2.name = 'Matcap';
|
106
|
-
world.add(mesh2);
|
107
|
-
items.push(mesh2);
|
108
|
-
|
109
|
-
const mesh5 = new Mesh(geom, new MeshPhongMaterial({ name: 'PhongMaterial', transparent: true }));
|
110
|
-
mesh5.name = 'Phong';
|
111
|
-
world.add(mesh5);
|
112
|
-
items.push(mesh5);
|
113
|
-
|
114
|
-
const mesh3 = new Mesh(geom, new MeshPhysicalMaterial({ name: 'PhysicalMaterial', transparent: true }));
|
115
|
-
mesh3.name = 'Physical';
|
116
|
-
world.add(mesh3);
|
117
|
-
items.push(mesh3);
|
118
|
-
|
119
|
-
// CustomMaterial
|
120
|
-
this.customMat = new CustomMaterial();
|
121
|
-
const mesh4 = new Mesh(geom, this.customMat);
|
122
|
-
mesh4.name = 'Shader';
|
123
|
-
world.add(mesh4);
|
124
|
-
items.push(mesh4);
|
125
|
-
|
126
|
-
const spacing = 50;
|
127
|
-
const total = items.length;
|
128
|
-
const offset = ((total - 1) / 2) * spacing;
|
129
|
-
for (let i = 0; i < total; i++) {
|
130
|
-
const x = i * spacing - offset;
|
131
|
-
items[i].position.set(x, 100, -150);
|
132
|
-
items[i].castShadow = true;
|
133
|
-
}
|
134
|
-
}
|
135
|
-
|
136
|
-
private createPost() {
|
137
|
-
this.post = new EffectComposer(this.renderer);
|
138
|
-
this.post.addPass(new RenderPass(this, this.camera));
|
139
|
-
|
140
|
-
const fxaaEffect = new FXAAEffect();
|
141
|
-
fxaaEffect.minEdgeThreshold = 0.01;
|
142
|
-
this.post.addPass(new EffectPass(this.camera, fxaaEffect));
|
143
|
-
|
144
|
-
const blur = new TiltShiftEffect({
|
145
|
-
focusArea: 0.6
|
146
|
-
});
|
147
|
-
this.post.addPass(new EffectPass(this.camera, blur));
|
148
|
-
|
149
|
-
const noiseEffect = new NoiseEffect({});
|
150
|
-
noiseEffect.blendMode.opacity.value = 0.33;
|
151
|
-
noiseEffect.blendMode.blendFunction = BlendFunction.MULTIPLY;
|
152
|
-
const vignette = new VignetteEffect({});
|
153
|
-
this.post.addPass(new EffectPass(this.camera, noiseEffect, vignette));
|
154
|
-
}
|
155
|
-
|
156
|
-
private createAnimation() {
|
157
|
-
app.theatre.sheet(this.name);
|
158
|
-
|
159
|
-
// Camera
|
160
|
-
app.theatre.sheetObject(
|
161
|
-
this.name,
|
162
|
-
'Camera',
|
163
|
-
{
|
164
|
-
position: {
|
165
|
-
x: this.camera.position.x,
|
166
|
-
y: this.camera.position.y,
|
167
|
-
z: this.camera.position.z,
|
168
|
-
},
|
169
|
-
rotation: {
|
170
|
-
x: this.camera.rotation.x,
|
171
|
-
y: this.camera.rotation.y,
|
172
|
-
z: this.camera.rotation.z,
|
173
|
-
},
|
174
|
-
},
|
175
|
-
(data: any) => {
|
176
|
-
this.camera.position.set(data.position.x, data.position.y, data.position.z);
|
177
|
-
this.camera.rotation.set(data.rotation.x, data.rotation.y, data.rotation.z);
|
178
|
-
}
|
179
|
-
);
|
180
|
-
|
181
|
-
// Dancer
|
182
|
-
app.theatre.sheetObject(
|
183
|
-
this.name,
|
184
|
-
'Break Dancer',
|
185
|
-
{
|
186
|
-
position: {
|
187
|
-
x: this.dance.position.x,
|
188
|
-
y: this.dance.position.y,
|
189
|
-
z: this.dance.position.z,
|
190
|
-
},
|
191
|
-
rotation: {
|
192
|
-
x: this.dance.rotation.x,
|
193
|
-
y: this.dance.rotation.y,
|
194
|
-
z: this.dance.rotation.z,
|
195
|
-
},
|
196
|
-
},
|
197
|
-
(data: any) => {
|
198
|
-
this.dance.position.set(data.position.x, data.position.y, data.position.z);
|
199
|
-
this.dance.rotation.set(data.rotation.x, data.rotation.y, data.rotation.z);
|
200
|
-
}
|
201
|
-
);
|
202
|
-
|
203
|
-
app.theatre.playSheet(this.name, { iterationCount: Infinity });
|
204
|
-
}
|
205
|
-
|
206
|
-
override update() {
|
207
|
-
const delta = this.clock.getDelta();
|
208
|
-
this.customMat.update(delta);
|
209
|
-
this.dance.update(delta);
|
210
|
-
}
|
211
|
-
|
212
|
-
override draw() {
|
213
|
-
if (app.editor) {
|
214
|
-
//
|
215
|
-
} else {
|
216
|
-
//
|
217
|
-
}
|
218
|
-
this.post.render();
|
219
|
-
}
|
220
|
-
|
221
|
-
override resize(width: number, height: number): void {
|
222
|
-
super.resize(width, height);
|
223
|
-
if (!app.editor) this.post.setSize(width, height);
|
224
|
-
}
|
225
|
-
}
|
@@ -1,138 +0,0 @@
|
|
1
|
-
import { DirectionalLight, LineBasicMaterial, LineSegments, Mesh, MeshBasicMaterial, MeshMatcapMaterial, Object3D, Points, PointsMaterial, SkinnedMesh, SphereGeometry, SpotLight, WebGLRenderer } from 'three';
|
2
|
-
import { IS_DEV, app } from '../constants';
|
3
|
-
import { hierarchyUUID } from '../../editor/utils';
|
4
|
-
import BaseScene from './BaseScene';
|
5
|
-
import FBXAnimation from './FBXAnimation';
|
6
|
-
import { textures } from './loader';
|
7
|
-
|
8
|
-
export default class Scene2 extends BaseScene {
|
9
|
-
dance!: FBXAnimation;
|
10
|
-
|
11
|
-
constructor(renderer: WebGLRenderer) {
|
12
|
-
super(renderer);
|
13
|
-
this.name = 'Scene2';
|
14
|
-
this.camera.position.set(0, 0, 125);
|
15
|
-
this.camera.lookAt(0, 0, 0);
|
16
|
-
|
17
|
-
this.createLights();
|
18
|
-
this.createWorld();
|
19
|
-
this.createAnimation();
|
20
|
-
if (IS_DEV) hierarchyUUID(this);
|
21
|
-
}
|
22
|
-
|
23
|
-
private createLights() {
|
24
|
-
const lights = new Object3D();
|
25
|
-
lights.name = 'lights';
|
26
|
-
this.add(lights);
|
27
|
-
|
28
|
-
const sun = new DirectionalLight(0xffffff, 0.25);
|
29
|
-
sun.name = 'sun';
|
30
|
-
sun.castShadow = true;
|
31
|
-
sun.position.set(0, 50, 50);
|
32
|
-
lights.add(sun);
|
33
|
-
|
34
|
-
const spotlight = new SpotLight(0xffffff, 3);
|
35
|
-
spotlight.angle = 5.8;
|
36
|
-
spotlight.decay = 0;
|
37
|
-
spotlight.distance = 1000;
|
38
|
-
spotlight.penumbra = Math.PI;
|
39
|
-
spotlight.name = 'spotlight';
|
40
|
-
spotlight.position.set(-50, 200, 200);
|
41
|
-
spotlight.lookAt(0, 50, 0);
|
42
|
-
lights.add(spotlight);
|
43
|
-
}
|
44
|
-
|
45
|
-
private createWorld() {
|
46
|
-
const world = new Object3D();
|
47
|
-
world.name = 'world';
|
48
|
-
this.add(world);
|
49
|
-
|
50
|
-
const gridTexture = textures.get('uv_grid')!;
|
51
|
-
gridTexture.repeat.setScalar(10);
|
52
|
-
gridTexture.needsUpdate = true;
|
53
|
-
const floorMaterial = new MeshBasicMaterial({
|
54
|
-
map: gridTexture,
|
55
|
-
});
|
56
|
-
const floor = new Mesh(new SphereGeometry(250, 36), floorMaterial);
|
57
|
-
floor.name = 'floor';
|
58
|
-
floor.receiveShadow = true;
|
59
|
-
floor.position.y = -75;
|
60
|
-
floor.scale.y = 0.1;
|
61
|
-
world.add(floor);
|
62
|
-
|
63
|
-
const points = new Points(new SphereGeometry(50), new PointsMaterial({ size: 2 }));
|
64
|
-
points.name = 'points';
|
65
|
-
points.position.x = -100;
|
66
|
-
world.add(points);
|
67
|
-
|
68
|
-
const lines = new LineSegments(new SphereGeometry(50), new LineBasicMaterial());
|
69
|
-
lines.name = 'lines';
|
70
|
-
lines.position.x = 100;
|
71
|
-
world.add(lines);
|
72
|
-
|
73
|
-
this.dance = new FBXAnimation('Flair');
|
74
|
-
this.dance.name = 'flair';
|
75
|
-
this.dance.traverse((obj: Object3D) => {
|
76
|
-
if (obj instanceof SkinnedMesh) {
|
77
|
-
const mesh = obj as SkinnedMesh;
|
78
|
-
mesh.material = new MeshMatcapMaterial();
|
79
|
-
}
|
80
|
-
});
|
81
|
-
world.add(this.dance);
|
82
|
-
}
|
83
|
-
|
84
|
-
private createAnimation() {
|
85
|
-
app.theatre.sheet(this.name);
|
86
|
-
|
87
|
-
// Camera
|
88
|
-
app.theatre.sheetObject(
|
89
|
-
this.name,
|
90
|
-
'Camera',
|
91
|
-
{
|
92
|
-
position: {
|
93
|
-
x: this.camera.position.x,
|
94
|
-
y: this.camera.position.y,
|
95
|
-
z: this.camera.position.z,
|
96
|
-
},
|
97
|
-
rotation: {
|
98
|
-
x: this.camera.rotation.x,
|
99
|
-
y: this.camera.rotation.y,
|
100
|
-
z: this.camera.rotation.z,
|
101
|
-
},
|
102
|
-
},
|
103
|
-
(data: any) => {
|
104
|
-
this.camera.position.set(data.position.x, data.position.y, data.position.z);
|
105
|
-
this.camera.rotation.set(data.rotation.x, data.rotation.y, data.rotation.z);
|
106
|
-
}
|
107
|
-
);
|
108
|
-
|
109
|
-
// Dancer
|
110
|
-
app.theatre.sheetObject(
|
111
|
-
this.name,
|
112
|
-
'Dancer',
|
113
|
-
{
|
114
|
-
position: {
|
115
|
-
x: this.dance.position.x,
|
116
|
-
y: this.dance.position.y,
|
117
|
-
z: this.dance.position.z,
|
118
|
-
},
|
119
|
-
rotation: {
|
120
|
-
x: this.dance.rotation.x,
|
121
|
-
y: this.dance.rotation.y,
|
122
|
-
z: this.dance.rotation.z,
|
123
|
-
},
|
124
|
-
},
|
125
|
-
(data: any) => {
|
126
|
-
this.dance.position.set(data.position.x, data.position.y, data.position.z);
|
127
|
-
this.dance.rotation.set(data.rotation.x, data.rotation.y, data.rotation.z);
|
128
|
-
}
|
129
|
-
);
|
130
|
-
|
131
|
-
app.theatre.playSheet(this.name, { iterationCount: Infinity });
|
132
|
-
}
|
133
|
-
|
134
|
-
override update(): void {
|
135
|
-
const delta = this.clock.getDelta();
|
136
|
-
this.dance.update(delta);
|
137
|
-
}
|
138
|
-
}
|
@@ -1,110 +0,0 @@
|
|
1
|
-
import { CubeTexture, CubeTextureLoader, Group, Object3D, RepeatWrapping, Texture, TextureLoader } from 'three';
|
2
|
-
import { FBXLoader } from 'three/examples/jsm/loaders/FBXLoader';
|
3
|
-
import { Events, app, threeDispatcher } from '../constants';
|
4
|
-
|
5
|
-
export const cubeTextures: Map<string, CubeTexture> = new Map();
|
6
|
-
export const json: Map<string, any> = new Map();
|
7
|
-
export const models: Map<string, Group> = new Map();
|
8
|
-
export const textures: Map<string, Texture> = new Map();
|
9
|
-
|
10
|
-
export function loadCube(name: string, source: string[]): Promise<CubeTexture> {
|
11
|
-
return new Promise((resolve, reject) => {
|
12
|
-
new CubeTextureLoader()
|
13
|
-
.setPath('images/milkyWay/')
|
14
|
-
.load(source, (value: CubeTexture) => {
|
15
|
-
cubeTextures.set(name, value);
|
16
|
-
resolve(value);
|
17
|
-
}, undefined, () => {
|
18
|
-
reject();
|
19
|
-
});
|
20
|
-
});
|
21
|
-
}
|
22
|
-
|
23
|
-
export function loadModel(name: string, source: string): Promise<Group> {
|
24
|
-
return new Promise((resolve, reject) => {
|
25
|
-
new FBXLoader()
|
26
|
-
.setPath('./models/')
|
27
|
-
.loadAsync(source)
|
28
|
-
.then((model: Group) => {
|
29
|
-
// Shadows
|
30
|
-
model.traverse((obj: Object3D) => {
|
31
|
-
if (obj['isMesh']) {
|
32
|
-
obj.castShadow = true;
|
33
|
-
obj.receiveShadow = true;
|
34
|
-
}
|
35
|
-
});
|
36
|
-
|
37
|
-
models.set(name, model);
|
38
|
-
resolve(model);
|
39
|
-
})
|
40
|
-
.catch((reason: any) => {
|
41
|
-
console.log(`Couldn't load:`, source);
|
42
|
-
console.log(reason);
|
43
|
-
reject();
|
44
|
-
});
|
45
|
-
});
|
46
|
-
}
|
47
|
-
|
48
|
-
export function loadTexture(name: string, source: string): Promise<Texture> {
|
49
|
-
return new Promise((resolve, reject) => {
|
50
|
-
new TextureLoader()
|
51
|
-
.load(source, (value: Texture) => {
|
52
|
-
value.wrapS = RepeatWrapping;
|
53
|
-
value.wrapT = RepeatWrapping;
|
54
|
-
value.needsUpdate = true;
|
55
|
-
textures.set(name, value);
|
56
|
-
resolve(value);
|
57
|
-
}, undefined, () => {
|
58
|
-
reject();
|
59
|
-
});
|
60
|
-
});
|
61
|
-
}
|
62
|
-
|
63
|
-
export function loadJSON(name: string, source: string): Promise<any> {
|
64
|
-
return new Promise((resolve, reject) => {
|
65
|
-
fetch(source)
|
66
|
-
.then(response => {
|
67
|
-
if (!response.ok) {
|
68
|
-
throw new Error(`Network response was not ok: ${response.status}`);
|
69
|
-
}
|
70
|
-
return response.json();
|
71
|
-
})
|
72
|
-
.then(data => {
|
73
|
-
json.set(name, data);
|
74
|
-
resolve(data);
|
75
|
-
})
|
76
|
-
.catch(() => {
|
77
|
-
console.log(`Couldn't load: ${source}`);
|
78
|
-
reject();
|
79
|
-
});
|
80
|
-
});
|
81
|
-
}
|
82
|
-
|
83
|
-
export function loadAssets(): Promise<void> {
|
84
|
-
return new Promise((resolve, reject) => {
|
85
|
-
const assets: (() => Promise<any>)[] = [
|
86
|
-
() => loadCube('environment', [
|
87
|
-
'dark-s_px.jpg',
|
88
|
-
'dark-s_nx.jpg',
|
89
|
-
'dark-s_py.jpg',
|
90
|
-
'dark-s_ny.jpg',
|
91
|
-
'dark-s_pz.jpg',
|
92
|
-
'dark-s_nz.jpg'
|
93
|
-
]),
|
94
|
-
() => loadTexture('uv_grid', 'images/uv_grid_opengl.jpg'),
|
95
|
-
() => loadModel('Flair', 'Flair.fbx'),
|
96
|
-
() => loadJSON('animation', 'json/animation.json'),
|
97
|
-
];
|
98
|
-
|
99
|
-
Promise.all(assets.map(load => load()))
|
100
|
-
.then(() => {
|
101
|
-
app.onLoad().then(() => {
|
102
|
-
threeDispatcher.dispatchEvent({ type: Events.LOAD_COMPLETE });
|
103
|
-
resolve();
|
104
|
-
});
|
105
|
-
})
|
106
|
-
.catch(() => {
|
107
|
-
reject();
|
108
|
-
});
|
109
|
-
});
|
110
|
-
}
|
package/src/index.ts
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
// Core
|
2
|
-
export * from './editor/utils';
|
3
|
-
export { default as Application } from './core/Application';
|
4
|
-
export { debugDispatcher, ToolEvents } from './editor/global';
|
5
|
-
export { default as BaseRemote } from './core/remote/BaseRemote';
|
6
|
-
export { default as RemoteComponents } from './core/remote/RemoteComponents';
|
7
|
-
export { default as RemoteTheatre } from './core/remote/RemoteTheatre';
|
8
|
-
export { default as RemoteThree } from './core/remote/RemoteThree';
|
9
|
-
export { default as RemoteTweakpane } from './core/remote/RemoteTweakpane';
|
10
|
-
// Components
|
11
|
-
export { default as NavButton } from './editor/components/NavButton';
|
12
|
-
export { default as DraggableItem } from './editor/components/DraggableItem';
|
13
|
-
export { default as Draggable } from './editor/components/Draggable';
|
14
|
-
export { default as DropdownItem } from './editor/components/DropdownItem';
|
15
|
-
export { default as Dropdown } from './editor/components/Dropdown';
|
16
|
-
export { default as RemoteController } from './core/RemoteController';
|
17
|
-
// RemoteThree
|
18
|
-
export { default as InfiniteGridHelper } from './editor/multiView/InfiniteGridHelper';
|
19
|
-
export { default as UVMaterial } from './editor/multiView/UVMaterial';
|
20
|
-
export { default as SidePanel } from './editor/sidePanel/SidePanel';
|
21
|
-
export { default as Accordion } from './editor/sidePanel/Accordion';
|
22
|
-
export { default as ChildObject } from './editor/sidePanel/ChildObject';
|
23
|
-
export { default as ContainerObject } from './editor/sidePanel/ContainerObject';
|
24
|
-
export { default as Inspector } from './editor/sidePanel/inspector/Inspector';
|
25
|
-
export { default as SceneInspector } from './editor/sidePanel/inspector/SceneInspector';
|
26
|
-
export { default as MultiView } from './editor/multiView/MultiView';
|
27
|
-
export { default as Editor } from './editor/Editor';
|
package/src/vite-env.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
/// <reference types='vite/client' />
|