@tomorrowevening/hermes 0.0.6 → 0.0.8

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.
@@ -38,17 +38,21 @@ export function acceptedMaterialNames(name: string): boolean {
38
38
  );
39
39
  }
40
40
 
41
- export function niceMaterialNames(name: string): string {
41
+ export function prettyName(name: string): string {
42
42
  switch (name) {
43
43
  case 'alphaMap': return 'Alpha Map';
44
+ case 'anisotropyMap': return 'Anisotropy Map';
44
45
  case 'anisotropyRotation': return 'Anisotropy Rotation';
45
46
  case 'aoMap': return 'AO Map';
46
47
  case 'aoMapIntensity': return 'AO Map Intensity';
47
48
  case 'attenuationColor': return 'Attenuation Color';
48
49
  case 'bumpMap': return 'Bump Map';
49
50
  case 'bumpScale': return 'Bump Scale';
51
+ case 'clearcoatMap': return 'Clearcoat Map';
52
+ case 'clearcoatNormalMap': return 'Clearcoat Normal Map';
50
53
  case 'clearcoatNormalScale': return 'Clearcoat Normal Scale';
51
54
  case 'clearcoatRoughness': return 'Clearcoat Roughness';
55
+ case 'clearcoatRoughnessMap': return 'Clearcoat Roughness Map';
52
56
  case 'color': return 'Color';
53
57
  case 'defines': return 'Defines';
54
58
  case 'depthTest': return 'Depth Test';
@@ -58,6 +62,7 @@ export function niceMaterialNames(name: string): string {
58
62
  case 'displacementScale': return 'Displacement Scale';
59
63
  case 'dithering': return 'Dithering';
60
64
  case 'emissive': return 'Emissive';
65
+ case 'emissiveMap': return 'Emissive Map';
61
66
  case 'emissiveIntensity': return 'Emissive Intensity';
62
67
  case 'envMap': return 'Environment Map';
63
68
  case 'envMapIntensity': return 'Environment Map Intensity';
@@ -68,6 +73,8 @@ export function niceMaterialNames(name: string): string {
68
73
  case 'gradientMap': return 'Gradient Map';
69
74
  case 'ior': return 'IOR';
70
75
  case 'iridescenceIOR': return 'Iridescence IOR';
76
+ case 'iridescenceMap': return 'Iridescence Map';
77
+ case 'iridescenceThicknessMap': return 'Iridescence Thickness Map';
71
78
  case 'iridescenceThicknessRange': return 'Iridescence Thickness Range';
72
79
  case 'lights': return 'Lights';
73
80
  case 'lightMap': return 'Light Map';
@@ -75,6 +82,7 @@ export function niceMaterialNames(name: string): string {
75
82
  case 'map': return 'Map';
76
83
  case 'matcap': return 'Matcap';
77
84
  case 'metalness': return 'Metalness';
85
+ case 'metalnessMap': return 'Metalness Map';
78
86
  case 'name': return 'Name';
79
87
  case 'normalMap': return 'Normal Map';
80
88
  case 'normalScale': return 'Normal Scale';
@@ -82,13 +90,21 @@ export function niceMaterialNames(name: string): string {
82
90
  case 'reflectivity': return 'Reflectivity';
83
91
  case 'refractionRatio': return 'Refraction Ratio';
84
92
  case 'roughness': return 'Roughness';
93
+ case 'roughnessMap': return 'Roughness Map';
85
94
  case 'sheenColor': return 'Sheen Color';
95
+ case 'sheenColorMap': return 'Sheen Color Map';
86
96
  case 'sheenRoughness': return 'Sheen Roughness';
97
+ case 'sheenRoughnessMap': return 'Sheen Roughness Map';
87
98
  case 'shininess': return 'Shininess';
88
99
  case 'specular': return 'Specular';
89
100
  case 'specularColor': return 'Specular Color';
101
+ case 'specularColorMap': return 'Specular Color Map';
90
102
  case 'specularIntensity': return 'Specular Intensity';
103
+ case 'specularIntensityMap': return 'Specular Map Intensity';
91
104
  case 'thickness': return 'Thickness';
105
+ case 'thicknessMap': return 'Thickness Map';
106
+ case 'transmission': return 'Transmission';
107
+ case 'transmissionMap': return 'Transmission Map';
92
108
  case 'transparent': return 'Transparent';
93
109
  case 'type': return 'Type';
94
110
  case 'uuid': return 'UUID';
@@ -147,7 +163,7 @@ export function inspectMaterialItems(material: RemoteMaterial, object: RemoteObj
147
163
  const value = material[i];
148
164
  if (propType === 'boolean' || propType === 'number' || propType === 'string') {
149
165
  const newField = {
150
- title: niceMaterialNames(i),
166
+ title: prettyName(i),
151
167
  prop: i,
152
168
  type: propType,
153
169
  value: value,
@@ -176,7 +192,7 @@ export function inspectMaterialItems(material: RemoteMaterial, object: RemoteObj
176
192
  } else if (propType === 'object') {
177
193
  if (value.isColor) {
178
194
  items.push({
179
- title: niceMaterialNames(i),
195
+ title: prettyName(i),
180
196
  prop: i,
181
197
  type: 'color',
182
198
  value: value,
@@ -204,7 +220,7 @@ export function inspectMaterialItems(material: RemoteMaterial, object: RemoteObj
204
220
  });
205
221
  }
206
222
  items.push({
207
- title: niceMaterialNames(i),
223
+ title: prettyName(i),
208
224
  items: subChildren,
209
225
  });
210
226
  } else {
@@ -218,7 +234,7 @@ export function inspectMaterialItems(material: RemoteMaterial, object: RemoteObj
218
234
  case 'string':
219
235
  if (n === 'src') {
220
236
  items.push({
221
- title: niceMaterialNames(i),
237
+ title: prettyName(i),
222
238
  type: 'image',
223
239
  value: propValue,
224
240
  onChange: (prop: string, value: any) => {
@@ -235,7 +251,7 @@ export function inspectMaterialItems(material: RemoteMaterial, object: RemoteObj
235
251
  });
236
252
  } else {
237
253
  subChildren.push({
238
- title: `${niceMaterialNames(n)}`,
254
+ title: `${prettyName(n)}`,
239
255
  prop: `material.${i}.${n}`,
240
256
  type: `${typeof material[i][n]}`,
241
257
  value: value[n],
@@ -252,7 +268,7 @@ export function inspectMaterialItems(material: RemoteMaterial, object: RemoteObj
252
268
  // Uniform textures
253
269
  if (propValue.value !== undefined && propValue.value.src !== undefined) {
254
270
  subChildren.push({
255
- title: niceMaterialNames(n),
271
+ title: prettyName(n),
256
272
  type: 'image',
257
273
  value: propValue.value.src,
258
274
  onChange: (prop: string, value: any) => {
@@ -285,7 +301,7 @@ export function inspectMaterialItems(material: RemoteMaterial, object: RemoteObj
285
301
 
286
302
  if (subChildren.length > 0) {
287
303
  items.push({
288
- title: niceMaterialNames(i),
304
+ title: prettyName(i),
289
305
  items: subChildren,
290
306
  });
291
307
  }
@@ -1,4 +1,4 @@
1
- import { Camera, CubeTexture, Light, Material, Mesh, Object3D, OrthographicCamera, PerspectiveCamera, RepeatWrapping, Texture } from 'three';
1
+ import { CubeTexture, Material, Mesh, Object3D, RepeatWrapping, Texture } from 'three';
2
2
  import { MinimumObject, RemoteMaterial, RemoteObject } from './types';
3
3
 
4
4
  export function determineIcon(obj: Object3D): string {
@@ -132,9 +132,15 @@ export function stripObject(obj: Object3D): RemoteObject {
132
132
  uuid: obj.uuid,
133
133
  visible: obj.visible,
134
134
  matrix: obj.matrix.elements,
135
+ material: undefined,
136
+ perspectiveCameraInfo: undefined,
137
+ orthographicCameraInfo: undefined,
138
+ lightInfo: undefined,
135
139
  };
136
140
 
137
- if (obj instanceof Mesh) {
141
+ const type = obj.type.toLowerCase();
142
+
143
+ if (type.search('mesh') > -1) {
138
144
  const mesh = obj as Mesh;
139
145
  if (Array.isArray(mesh.material)) {
140
146
  const data: RemoteMaterial[] = [];
@@ -145,33 +151,33 @@ export function stripObject(obj: Object3D): RemoteObject {
145
151
  } else {
146
152
  stripped.material = stripMaterialData(mesh.material);
147
153
  }
148
- } else if (obj instanceof Camera) {
149
- if (obj instanceof PerspectiveCamera) {
154
+ } else if (type.search('camera') > -1) {
155
+ if (obj.type === 'PerspectiveCamera') {
150
156
  stripped.perspectiveCameraInfo = {
151
- fov: obj.fov,
152
- zoom: obj.zoom,
153
- near: obj.near,
154
- far: obj.far,
155
- focus: obj.focus,
156
- aspect: obj.aspect,
157
- filmGauge: obj.filmGauge,
158
- filmOffset: obj.filmOffset,
157
+ fov: obj['fov'],
158
+ zoom: obj['zoom'],
159
+ near: obj['near'],
160
+ far: obj['far'],
161
+ focus: obj['focus'],
162
+ aspect: obj['aspect'],
163
+ filmGauge: obj['filmGauge'],
164
+ filmOffset: obj['filmOffset'],
159
165
  };
160
- } else if (obj instanceof OrthographicCamera) {
166
+ } else if (obj.type === 'OrthographicCamera') {
161
167
  stripped.orthographicCameraInfo = {
162
- zoom: obj.zoom,
163
- near: obj.near,
164
- far: obj.far,
165
- left: obj.left,
166
- right: obj.right,
167
- top: obj.top,
168
- bottom: obj.bottom,
168
+ zoom: obj['zoom'],
169
+ near: obj['near'],
170
+ far: obj['far'],
171
+ left: obj['left'],
172
+ right: obj['right'],
173
+ top: obj['top'],
174
+ bottom: obj['bottom'],
169
175
  };
170
176
  }
171
- } else if (obj instanceof Light) {
177
+ } else if (type.search('light') > -1) {
172
178
  stripped.lightInfo = {
173
- color: obj.color,
174
- intensity: obj.intensity,
179
+ color: obj['color'],
180
+ intensity: obj['intensity'],
175
181
  decay: obj['decay'],
176
182
  distance: obj['distance'],
177
183
  angle: obj['angle'],
@@ -1,3 +1,3 @@
1
1
  import RemoteThree from '@/core/remote/RemoteThree';
2
- import { RemoteObject } from "../../types";
2
+ import { RemoteObject } from '../../types';
3
3
  export declare function InspectCamera(object: RemoteObject, three: RemoteThree): any;
@@ -1,3 +1,3 @@
1
- import { RemoteObject } from "../../types";
2
1
  import RemoteThree from '@/core/remote/RemoteThree';
2
+ import { RemoteObject } from '../../types';
3
3
  export declare function InspectLight(obj: RemoteObject, three: RemoteThree): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { RemoteMaterial, RemoteObject } from "../../types";
2
2
  import RemoteThree from '@/core/remote/RemoteThree';
3
3
  export declare function acceptedMaterialNames(name: string): boolean;
4
- export declare function niceMaterialNames(name: string): string;
4
+ export declare function prettyName(name: string): string;
5
5
  export declare function clampedNames(name: string): boolean;
6
6
  export declare function uploadLocalImage(): Promise<string>;
7
7
  export declare function inspectMaterialItems(material: RemoteMaterial, object: RemoteObject, three: RemoteThree): any[];