@tomorrowevening/hermes 0.0.4 → 0.0.6
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 +760 -739
- package/dist/hermes.umd.cjs +14 -14
- package/package.json +9 -8
- package/src/core/RemoteController.ts +3 -4
- package/src/core/remote/RemoteThree.ts +2 -0
- package/src/index.ts +1 -0
- package/types/index.d.ts +1 -0
- package/dist/images/android-chrome-192x192.png +0 -0
- package/dist/images/android-chrome-512x512.png +0 -0
- package/dist/images/apple-touch-icon.png +0 -0
- package/dist/images/favicon-16x16.png +0 -0
- package/dist/images/favicon-32x32.png +0 -0
- package/dist/images/favicon.ico +0 -0
- package/dist/images/milkyWay/dark-s_nx.jpg +0 -0
- package/dist/images/milkyWay/dark-s_ny.jpg +0 -0
- package/dist/images/milkyWay/dark-s_nz.jpg +0 -0
- package/dist/images/milkyWay/dark-s_px.jpg +0 -0
- package/dist/images/milkyWay/dark-s_py.jpg +0 -0
- package/dist/images/milkyWay/dark-s_pz.jpg +0 -0
- package/dist/images/site.webmanifest +0 -1
- package/dist/images/uv_grid_opengl.jpg +0 -0
- package/dist/index-0a798fe4.js +0 -6862
- package/dist/index-7bad599d.css +0 -1
- package/dist/index.html +0 -18
- package/dist/models/Flair.fbx +0 -0
- package/dist/models/Thriller2.fbx +0 -0
- package/dist/models/Thriller4.fbx +0 -0
- package/src/example/CustomEditor.tsx +0 -40
- package/src/example/components/App.css +0 -6
- package/src/example/components/App.tsx +0 -164
- package/src/example/constants.ts +0 -44
- package/src/example/index.scss +0 -37
- package/src/example/main.tsx +0 -35
- package/src/example/three/CustomMaterial.ts +0 -58
- package/src/example/three/ExampleScene.ts +0 -176
- package/src/example/three/FBXAnimation.ts +0 -39
- package/src/vite-env.d.ts +0 -1
- package/types/example/CustomEditor.d.ts +0 -1
- package/types/example/components/App.d.ts +0 -3
- package/types/example/constants.d.ts +0 -15
- package/types/example/main.d.ts +0 -1
- package/types/example/three/CustomMaterial.d.ts +0 -5
- package/types/example/three/ExampleScene.d.ts +0 -18
- package/types/example/three/FBXAnimation.d.ts +0 -6
@@ -1,176 +0,0 @@
|
|
1
|
-
import { BackSide, CircleGeometry, CubeTexture, CubeTextureLoader, DirectionalLight, HemisphereLight, Mesh, MeshBasicMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, Object3D, PerspectiveCamera, PlaneGeometry, RepeatWrapping, Scene, SphereGeometry, Texture, TextureLoader } from 'three';
|
2
|
-
import CustomMaterial from './CustomMaterial';
|
3
|
-
import { hierarchyUUID } from '@/editor/utils';
|
4
|
-
import { IS_DEV, app } from '../constants';
|
5
|
-
import FBXAnimation from './FBXAnimation';
|
6
|
-
|
7
|
-
export default class ExampleScene extends Scene {
|
8
|
-
camera!: PerspectiveCamera;
|
9
|
-
envMap: CubeTexture;
|
10
|
-
dance0!: FBXAnimation;
|
11
|
-
dance1!: FBXAnimation;
|
12
|
-
dance2!: FBXAnimation;
|
13
|
-
|
14
|
-
private customMat!: CustomMaterial;
|
15
|
-
private lastUpdate = -1;
|
16
|
-
|
17
|
-
constructor() {
|
18
|
-
super();
|
19
|
-
this.name = 'TestScene';
|
20
|
-
this.envMap = new CubeTextureLoader()
|
21
|
-
.setPath('images/milkyWay/')
|
22
|
-
.load([
|
23
|
-
'dark-s_px.jpg',
|
24
|
-
'dark-s_nx.jpg',
|
25
|
-
'dark-s_py.jpg',
|
26
|
-
'dark-s_ny.jpg',
|
27
|
-
'dark-s_pz.jpg',
|
28
|
-
'dark-s_nz.jpg'
|
29
|
-
], (value: CubeTexture) => {
|
30
|
-
this.background = value;
|
31
|
-
|
32
|
-
if (app.editor) {
|
33
|
-
const bg = new Mesh(new SphereGeometry(), new MeshBasicMaterial({ envMap: value, side: BackSide }));
|
34
|
-
bg.name = 'bg';
|
35
|
-
bg.scale.setScalar(1000);
|
36
|
-
this.add(bg);
|
37
|
-
}
|
38
|
-
});
|
39
|
-
|
40
|
-
this.createCameras();
|
41
|
-
this.createLights();
|
42
|
-
this.createWorld();
|
43
|
-
|
44
|
-
this.lastUpdate = Date.now();
|
45
|
-
if (IS_DEV) hierarchyUUID(this);
|
46
|
-
}
|
47
|
-
|
48
|
-
private createCameras() {
|
49
|
-
const cameras = new Object3D();
|
50
|
-
cameras.name = 'cameras';
|
51
|
-
this.add(cameras);
|
52
|
-
|
53
|
-
this.camera = new PerspectiveCamera(60, 1, 1, 2000);
|
54
|
-
this.camera.name = 'Main';
|
55
|
-
this.camera.position.set(0, 200, 300);
|
56
|
-
this.camera.lookAt(0, 0, 0);
|
57
|
-
cameras.add(this.camera);
|
58
|
-
}
|
59
|
-
|
60
|
-
private createLights() {
|
61
|
-
const lights = new Object3D();
|
62
|
-
lights.name = 'lights';
|
63
|
-
this.add(lights);
|
64
|
-
|
65
|
-
const sun = new DirectionalLight();
|
66
|
-
sun.name = 'sun';
|
67
|
-
sun.castShadow = true;
|
68
|
-
sun.position.set(0, 50, 50);
|
69
|
-
const shadow = 256;
|
70
|
-
sun.shadow.camera.top = shadow;
|
71
|
-
sun.shadow.camera.bottom = -shadow;
|
72
|
-
sun.shadow.camera.left = - shadow;
|
73
|
-
sun.shadow.camera.right = shadow;
|
74
|
-
sun.shadow.mapSize.width = 1024;
|
75
|
-
sun.shadow.mapSize.height = 1024;
|
76
|
-
sun.shadow.camera.near = 10;
|
77
|
-
sun.shadow.camera.far = 1000;
|
78
|
-
sun.shadow.bias = 0.0001;
|
79
|
-
lights.add(sun);
|
80
|
-
|
81
|
-
const hemi = new HemisphereLight(0x6fb4e2, 0xc46d27, 0.5);
|
82
|
-
hemi.name = 'hemi';
|
83
|
-
lights.add(hemi);
|
84
|
-
}
|
85
|
-
|
86
|
-
private createWorld() {
|
87
|
-
const world = new Object3D();
|
88
|
-
world.name = 'world';
|
89
|
-
this.add(world);
|
90
|
-
|
91
|
-
const floorMaterial = new MeshPhongMaterial();
|
92
|
-
const floor = new Mesh(new CircleGeometry(500, 36), floorMaterial);
|
93
|
-
floor.name = 'floor';
|
94
|
-
floor.receiveShadow = true;
|
95
|
-
floor.rotateX(-Math.PI / 2);
|
96
|
-
world.add(floor);
|
97
|
-
new TextureLoader().load('images/uv_grid_opengl.jpg', (texture: Texture) => {
|
98
|
-
texture.wrapS = RepeatWrapping;
|
99
|
-
texture.wrapT = RepeatWrapping;
|
100
|
-
texture.repeat.setScalar(10);
|
101
|
-
texture.needsUpdate = true;
|
102
|
-
floorMaterial.map = texture;
|
103
|
-
floorMaterial.needsUpdate = true;
|
104
|
-
});
|
105
|
-
|
106
|
-
this.dance0 = new FBXAnimation('Thriller2.fbx');
|
107
|
-
this.dance0.position.set(-150, 0, -175);
|
108
|
-
world.add(this.dance0);
|
109
|
-
|
110
|
-
this.dance1 = new FBXAnimation('Flair.fbx');
|
111
|
-
this.dance1.position.set(0, 0, 0);
|
112
|
-
world.add(this.dance1);
|
113
|
-
|
114
|
-
this.dance2 = new FBXAnimation('Thriller4.fbx');
|
115
|
-
this.dance2.position.set(150, 0, -185);
|
116
|
-
world.add(this.dance2);
|
117
|
-
|
118
|
-
this.createTestMaterials(world);
|
119
|
-
}
|
120
|
-
|
121
|
-
private createTestMaterials(world: Object3D) {
|
122
|
-
const geom = new SphereGeometry(20);
|
123
|
-
|
124
|
-
const items: Mesh[] = [];
|
125
|
-
const mesh = new Mesh(geom, new MeshBasicMaterial({ name: 'BasicMaterial', transparent: true }));
|
126
|
-
mesh.name = 'Basic';
|
127
|
-
world.add(mesh);
|
128
|
-
items.push(mesh);
|
129
|
-
|
130
|
-
const mesh2 = new Mesh(geom, new MeshMatcapMaterial({ transparent: true }));
|
131
|
-
mesh2.name = 'Matcap';
|
132
|
-
world.add(mesh2);
|
133
|
-
items.push(mesh2);
|
134
|
-
|
135
|
-
const mesh5 = new Mesh(geom, new MeshPhongMaterial({ name: 'PhongMaterial', transparent: true }));
|
136
|
-
mesh5.name = 'Phong';
|
137
|
-
world.add(mesh5);
|
138
|
-
items.push(mesh5);
|
139
|
-
|
140
|
-
const mesh3 = new Mesh(geom, new MeshPhysicalMaterial({ name: 'PhysicalMaterial', transparent: true }));
|
141
|
-
mesh3.name = 'Physical';
|
142
|
-
world.add(mesh3);
|
143
|
-
items.push(mesh3);
|
144
|
-
|
145
|
-
// CustomMaterial
|
146
|
-
this.customMat = new CustomMaterial();
|
147
|
-
const mesh4 = new Mesh(geom, this.customMat);
|
148
|
-
mesh4.name = 'Shader';
|
149
|
-
world.add(mesh4);
|
150
|
-
items.push(mesh4);
|
151
|
-
|
152
|
-
const spacing = 50;
|
153
|
-
const total = items.length;
|
154
|
-
const offset = ((total - 1) / 2) * spacing;
|
155
|
-
for (let i = 0; i < total; i++) {
|
156
|
-
const x = i * spacing - offset;
|
157
|
-
items[i].position.set(x, 100, -150);
|
158
|
-
items[i].castShadow = true;
|
159
|
-
}
|
160
|
-
}
|
161
|
-
|
162
|
-
resize(width: number, height: number) {
|
163
|
-
this.camera.aspect = width / height;
|
164
|
-
this.camera.updateProjectionMatrix();
|
165
|
-
}
|
166
|
-
|
167
|
-
update() {
|
168
|
-
const now = Date.now();
|
169
|
-
const delta = (now - this.lastUpdate) / 1000;
|
170
|
-
this.lastUpdate = now;
|
171
|
-
this.customMat.update(delta);
|
172
|
-
this.dance0.update(delta);
|
173
|
-
this.dance1.update(delta);
|
174
|
-
this.dance2.update(delta);
|
175
|
-
}
|
176
|
-
}
|
@@ -1,39 +0,0 @@
|
|
1
|
-
import { AnimationMixer, Group, Object3D } from "three";
|
2
|
-
import { FBXLoader } from 'three/examples/jsm/loaders/FBXLoader';
|
3
|
-
|
4
|
-
export default class FBXAnimation extends Object3D {
|
5
|
-
mixer?: AnimationMixer;
|
6
|
-
|
7
|
-
constructor(source: string) {
|
8
|
-
super();
|
9
|
-
this.name = source.replaceAll(' ', '').split('.')[0];
|
10
|
-
this.scale.setScalar(0.5);
|
11
|
-
|
12
|
-
new FBXLoader()
|
13
|
-
.setPath('./models/')
|
14
|
-
.loadAsync(source)
|
15
|
-
.then((model: Group) => {
|
16
|
-
this.add(model);
|
17
|
-
|
18
|
-
// Shadows
|
19
|
-
model.traverse((obj: Object3D) => {
|
20
|
-
if (obj['isMesh']) {
|
21
|
-
obj.castShadow = true;
|
22
|
-
obj.receiveShadow = true;
|
23
|
-
}
|
24
|
-
});
|
25
|
-
|
26
|
-
this.mixer = new AnimationMixer(model);
|
27
|
-
const action = this.mixer.clipAction(model.animations[0]);
|
28
|
-
action.play();
|
29
|
-
})
|
30
|
-
.catch((reason: any) => {
|
31
|
-
console.log(`Couldn't load:`, source);
|
32
|
-
console.log(reason);
|
33
|
-
})
|
34
|
-
}
|
35
|
-
|
36
|
-
update(delta: number) {
|
37
|
-
this.mixer?.update(delta);
|
38
|
-
}
|
39
|
-
}
|
package/src/vite-env.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
/// <reference types="vite/client" />
|
@@ -1 +0,0 @@
|
|
1
|
-
export default function CustomEditor(): import("react/jsx-runtime").JSX.Element;
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import Application from '@/core/Application';
|
2
|
-
import RemoteComponents from '@/core/remote/RemoteComponents';
|
3
|
-
import RemoteTheatre from '@/core/remote/RemoteTheatre';
|
4
|
-
import RemoteThree from '@/core/remote/RemoteThree';
|
5
|
-
import RemoteTweakpane from '@/core/remote/RemoteTweakpane';
|
6
|
-
export declare const IS_DEV = true;
|
7
|
-
declare class CustomApp extends Application {
|
8
|
-
constructor(name: string, debugEnabled: boolean, editorHashtag: string);
|
9
|
-
get debug(): RemoteTweakpane;
|
10
|
-
get debugComponents(): RemoteComponents;
|
11
|
-
get theatre(): RemoteTheatre;
|
12
|
-
get three(): RemoteThree;
|
13
|
-
}
|
14
|
-
export declare const app: CustomApp;
|
15
|
-
export {};
|
package/types/example/main.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
import './index.scss';
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import { CubeTexture, PerspectiveCamera, Scene } from 'three';
|
2
|
-
import FBXAnimation from './FBXAnimation';
|
3
|
-
export default class ExampleScene extends Scene {
|
4
|
-
camera: PerspectiveCamera;
|
5
|
-
envMap: CubeTexture;
|
6
|
-
dance0: FBXAnimation;
|
7
|
-
dance1: FBXAnimation;
|
8
|
-
dance2: FBXAnimation;
|
9
|
-
private customMat;
|
10
|
-
private lastUpdate;
|
11
|
-
constructor();
|
12
|
-
private createCameras;
|
13
|
-
private createLights;
|
14
|
-
private createWorld;
|
15
|
-
private createTestMaterials;
|
16
|
-
resize(width: number, height: number): void;
|
17
|
-
update(): void;
|
18
|
-
}
|