@tomorrowevening/hermes 0.0.115 → 0.0.117

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "module": "./dist/hermes.esm.js",
8
8
  "types": "./types/index.d.ts",
9
9
  "type": "module",
10
- "version": "0.0.115",
10
+ "version": "0.0.117",
11
11
  "homepage": "https://github.com/tomorrowevening/hermes#readme",
12
12
  "bugs": {
13
13
  "url": "https://github.com/tomorrowevening/hermes/issues"
@@ -60,6 +60,7 @@
60
60
  "@typescript-eslint/parser": "^6.4.0",
61
61
  "@vitejs/plugin-react": "^4.0.3",
62
62
  "camera-controls": "^2.9.0",
63
+ "detect-gpu": "^5.0.57",
63
64
  "eslint": "^8.45.0",
64
65
  "eslint-plugin-react": "^7.33.2",
65
66
  "eslint-plugin-react-hooks": "^4.6.0",
@@ -3,6 +3,8 @@ import Application from '../Application';
3
3
  import BaseRemote from './BaseRemote';
4
4
  import { BroadcastData, GroupData } from '../types';
5
5
  export default class RemoteThree extends BaseRemote {
6
+ canvas: HTMLCanvasElement | null;
7
+ inputElement: any;
6
8
  scene?: Scene;
7
9
  scenes: Map<string, Scene>;
8
10
  renderer?: WebGLRenderer;
@@ -19,7 +21,7 @@ export default class RemoteThree extends BaseRemote {
19
21
  updateGroup(group: string, prop: string, value: any): void;
20
22
  removeAllGroups(): void;
21
23
  addSpline(spline: Curve<any>): void;
22
- addRenderer(value: WebGLRenderer): void;
24
+ setRenderer(value: WebGLRenderer, inputElement?: any): void;
23
25
  updateRenderer(data: any): void;
24
26
  addScene(value: Scene): void;
25
27
  refreshScene(value: string): void;
@@ -37,5 +39,4 @@ export default class RemoteThree extends BaseRemote {
37
39
  get dpr(): number;
38
40
  get width(): number;
39
41
  get height(): number;
40
- get canvas(): HTMLCanvasElement | null;
41
42
  }
@@ -1,31 +1,5 @@
1
- import { Material, Object3D, Texture, WebGLRenderer } from 'three';
2
1
  export declare function capitalize(value: string): string;
3
2
  export declare function copyToClipboard(data: any): string;
4
- export declare function clamp(min: number, max: number, value: number): number;
5
- export declare function normalize(min: number, max: number, value: number): number;
6
- export declare function mix(min: number, max: number, value: number): number;
7
- export declare function distance(x: number, y: number): number;
8
3
  export declare function randomID(): string;
9
4
  export declare function isColor(obj: any): boolean;
10
5
  export declare function colorToHex(obj: any): string;
11
- export declare function round(value: number, precision?: number): number;
12
- export declare let totalThreeObjects: number;
13
- export declare const resetThreeObjects: () => void;
14
- export declare const hierarchyUUID: (object: Object3D) => void;
15
- export declare const disposeTexture: (texture?: Texture) => void;
16
- export declare const disposeMaterial: (material?: Material | Material[]) => void;
17
- export declare const dispose: (object: Object3D) => void;
18
- export declare class ExportTexture {
19
- static renderer: WebGLRenderer;
20
- private static canvas;
21
- private static context;
22
- private static scene;
23
- private static camera;
24
- private static material;
25
- private static inited;
26
- private static width;
27
- private static height;
28
- private static init;
29
- static renderToBlob(texture: Texture): string;
30
- private static renderToCanvas;
31
- }
package/types/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export * from './core/types';
2
2
  export * from './editor/utils';
3
+ export * from './utils/three';
4
+ export * from './utils/detectSettings';
3
5
  export { default as Application } from './core/Application';
4
6
  export { debugDispatcher, ToolEvents } from './editor/global';
5
7
  export { default as BaseRemote } from './core/remote/BaseRemote';
@@ -0,0 +1,15 @@
1
+ export declare enum QualityType {
2
+ 'High' = 0,
3
+ 'Medium' = 1,
4
+ 'Low' = 2
5
+ }
6
+ export type AppSettings = {
7
+ dpr: number;
8
+ fps: number;
9
+ width: number;
10
+ height: number;
11
+ mobile: boolean;
12
+ supportOffScreenCanvas: boolean;
13
+ quality: QualityType;
14
+ };
15
+ export declare function detectSettings(canvas: HTMLCanvasElement): Promise<AppSettings>;
@@ -0,0 +1,5 @@
1
+ export declare function clamp(min: number, max: number, value: number): number;
2
+ export declare function normalize(min: number, max: number, value: number): number;
3
+ export declare function mix(min: number, max: number, value: number): number;
4
+ export declare function distance(x: number, y: number): number;
5
+ export declare function round(value: number, precision?: number): number;
@@ -0,0 +1,21 @@
1
+ import { Material, Object3D, Texture, WebGLRenderer } from 'three';
2
+ export declare const disposeTexture: (texture?: Texture) => void;
3
+ export declare const disposeMaterial: (material?: Material | Material[]) => void;
4
+ export declare const dispose: (object: Object3D) => void;
5
+ export declare let totalThreeObjects: number;
6
+ export declare const resetThreeObjects: () => void;
7
+ export declare const hierarchyUUID: (object: Object3D) => void;
8
+ export declare class ExportTexture {
9
+ static renderer: WebGLRenderer;
10
+ private static canvas;
11
+ private static context;
12
+ private static scene;
13
+ private static camera;
14
+ private static material;
15
+ private static inited;
16
+ private static width;
17
+ private static height;
18
+ private static init;
19
+ static renderToBlob(texture: Texture): string;
20
+ private static renderToCanvas;
21
+ }