@planara/core 1.4.8 → 1.5.0
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/core/editor-renderer.d.ts +31 -2
- package/dist/core/editor-renderer.d.ts.map +1 -1
- package/dist/core/preview-renderer.d.ts +1 -0
- package/dist/core/preview-renderer.d.ts.map +1 -1
- package/dist/core/renderer.d.ts +2 -1
- package/dist/core/renderer.d.ts.map +1 -1
- package/dist/extensions/orbit-extension.d.ts +14 -0
- package/dist/extensions/orbit-extension.d.ts.map +1 -0
- package/dist/handlers/display/wireframe-handler.d.ts +37 -0
- package/dist/handlers/display/wireframe-handler.d.ts.map +1 -0
- package/dist/hub/app-hub.d.ts +8 -0
- package/dist/hub/app-hub.d.ts.map +1 -0
- package/dist/hub/editor-hub.d.ts +13 -0
- package/dist/hub/editor-hub.d.ts.map +1 -0
- package/dist/index.cjs.js +32 -4
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +1646 -68
- package/dist/index.full.d.ts +216 -0
- package/dist/index.public.d.ts +174 -0
- package/dist/index.umd.js +32 -4
- package/dist/interfaces/display-handler.d.ts +12 -0
- package/dist/interfaces/display-handler.d.ts.map +1 -0
- package/dist/interfaces/handler.d.ts +22 -0
- package/dist/interfaces/handler.d.ts.map +1 -0
- package/dist/interfaces/manager.d.ts +22 -0
- package/dist/interfaces/manager.d.ts.map +1 -0
- package/dist/interfaces/mesh-api.d.ts +38 -0
- package/dist/interfaces/mesh-api.d.ts.map +1 -0
- package/dist/interfaces/renderer-api.d.ts +14 -0
- package/dist/interfaces/renderer-api.d.ts.map +1 -0
- package/dist/ioc/container.d.ts +4 -0
- package/dist/ioc/container.d.ts.map +1 -0
- package/dist/loaders/obj-loader.d.ts +2 -1
- package/dist/loaders/obj-loader.d.ts.map +1 -1
- package/dist/managers/display-manager.d.ts +19 -0
- package/dist/managers/display-manager.d.ts.map +1 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/utils/program-settings.d.ts +4 -3
- package/dist/utils/program-settings.d.ts.map +1 -1
- package/dist/utils/renderer-api.d.ts +19 -0
- package/dist/utils/renderer-api.d.ts.map +1 -0
- package/package.json +16 -4
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { Camera } from 'ogl';
|
|
2
|
+
import { DisplayMode } from '@planara/types';
|
|
3
|
+
import { Figure } from '@planara/types';
|
|
4
|
+
import { Geometry } from 'ogl';
|
|
5
|
+
import { Mesh } from 'ogl';
|
|
6
|
+
import { OGLRenderingContext } from 'ogl';
|
|
7
|
+
import { Program } from 'ogl';
|
|
8
|
+
import { Renderer as Renderer_2 } from 'ogl';
|
|
9
|
+
import { Transform } from 'ogl';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Создаёт или возвращает готовый экземпляр хаба.
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export declare function createAppHub(renderer: Renderer): EditorHub;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Хаб для управления редактированием
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export declare class EditorHub {
|
|
22
|
+
private displayManager;
|
|
23
|
+
constructor(displayManager: IDisplayManager);
|
|
24
|
+
setDisplayMode(mode: DisplayMode): void;
|
|
25
|
+
destroy(): void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Рендерер для редактора.
|
|
30
|
+
* Добавляет сетку, оси координат и поддержку Orbit для управления камерой.
|
|
31
|
+
* Наследуется от базового Renderer.
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export declare class EditorRenderer extends Renderer {
|
|
35
|
+
/** Orbit-контроллер для управления камерой */
|
|
36
|
+
private orbit;
|
|
37
|
+
/** Raycast для подсветки моделей при наведении */
|
|
38
|
+
private raycast;
|
|
39
|
+
/** Курсор мыши для остлеживания наведения на 3D-модель */
|
|
40
|
+
private mouse;
|
|
41
|
+
/** Были ли зарегистрированы обработчики событий для мыши */
|
|
42
|
+
private isEventListenersAdded;
|
|
43
|
+
/**
|
|
44
|
+
* Инициализация сцены редактора.
|
|
45
|
+
* Создает сетку, оси координат и orbit-контроллер.
|
|
46
|
+
* @param canvas - HTMLCanvasElement для рендеринга
|
|
47
|
+
*/
|
|
48
|
+
constructor(canvas: HTMLCanvasElement);
|
|
49
|
+
/**
|
|
50
|
+
* Добавляет фигуру в сцену и сохраняет его во внутреннем массиве.
|
|
51
|
+
*
|
|
52
|
+
* @param mesh - Фигура для добавления в сцену.
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
addMesh(mesh: Mesh): void;
|
|
56
|
+
/**
|
|
57
|
+
* Возвращает WebGL контекст рендерера.
|
|
58
|
+
*
|
|
59
|
+
* @returns Контекст WebGL (OGLRenderingContext) текущей сцены.
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
getContext(): OGLRenderingContext;
|
|
63
|
+
/**
|
|
64
|
+
* Убирает фигуру со сцены
|
|
65
|
+
*
|
|
66
|
+
* @param mesh - Фигура для удаления со сцены.
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
removeMesh(mesh: Mesh): void;
|
|
70
|
+
/**
|
|
71
|
+
* Возвращает список всех фигур, находящихся в сцене.
|
|
72
|
+
*
|
|
73
|
+
* @returns Массив текущих фигур.
|
|
74
|
+
* @internal
|
|
75
|
+
*/
|
|
76
|
+
getMeshes(): Mesh[];
|
|
77
|
+
/**
|
|
78
|
+
* Обновление состояния рендерера.
|
|
79
|
+
*/
|
|
80
|
+
protected update(): void;
|
|
81
|
+
/**
|
|
82
|
+
* Метод для добавления фигуры.
|
|
83
|
+
* Настройка raycast.
|
|
84
|
+
* @param figure - Данные фигуры: position, normal, uv
|
|
85
|
+
*/
|
|
86
|
+
addFigure(figure: Figure): Mesh<Geometry, Program>;
|
|
87
|
+
/**
|
|
88
|
+
* Обновление uniform uHit для конкретной 3D-модели
|
|
89
|
+
*/
|
|
90
|
+
protected updateHitUniform(mesh: Mesh): void;
|
|
91
|
+
/**
|
|
92
|
+
* Инициализация обработчиков мыши для raycast
|
|
93
|
+
*/
|
|
94
|
+
private initMouseListeners;
|
|
95
|
+
/**
|
|
96
|
+
* Обработчик движения мыши
|
|
97
|
+
*/
|
|
98
|
+
private handleMouseMove;
|
|
99
|
+
/** Деструктор */
|
|
100
|
+
destroy(): void;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Маркерный интерфейс для менеджеров отображения.
|
|
105
|
+
* @public
|
|
106
|
+
*/
|
|
107
|
+
export declare interface IDisplayManager extends IManager {
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Общий интерфейс для всех менеджеров в хабе.
|
|
112
|
+
* Каждый менеджер отвечает за одну фичу.
|
|
113
|
+
* @public
|
|
114
|
+
*/
|
|
115
|
+
export declare interface IManager {
|
|
116
|
+
/**
|
|
117
|
+
* Выполняет основное действие менеджера.
|
|
118
|
+
*/
|
|
119
|
+
manage(...args: unknown[]): void;
|
|
120
|
+
/**
|
|
121
|
+
* Освобождает ресурсы менеджера.
|
|
122
|
+
*/
|
|
123
|
+
destroy(): void;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** @public */
|
|
127
|
+
export declare class ObjLoader {
|
|
128
|
+
/** Позиции вершин */
|
|
129
|
+
private positions;
|
|
130
|
+
/** Нормали вершин */
|
|
131
|
+
private normals;
|
|
132
|
+
/** UV-координаты (опционально) */
|
|
133
|
+
private uvs;
|
|
134
|
+
private tmpPositions;
|
|
135
|
+
private tmpNormals;
|
|
136
|
+
private tmpUVs;
|
|
137
|
+
/**
|
|
138
|
+
* Загружает OBJ-модель в Figure
|
|
139
|
+
* @param objContent - Строка содержимого .obj файла
|
|
140
|
+
*/
|
|
141
|
+
load(objContent: string): Figure;
|
|
142
|
+
/**
|
|
143
|
+
* Обрабатывает строку face (f) и разворачивает индексы в массивы для рендеринга
|
|
144
|
+
*/
|
|
145
|
+
private processFaceLine;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Рендерер для предпросмотра 3D-модели.
|
|
150
|
+
* Настраивает сцену, камеру и орбитальную навигацию (по горизонтали).
|
|
151
|
+
* Наследуется от базового Renderer.
|
|
152
|
+
* @alpha
|
|
153
|
+
*/
|
|
154
|
+
export declare class PreviewRenderer extends Renderer {
|
|
155
|
+
/** Orbit-контроллер для управления камерой */
|
|
156
|
+
private orbit;
|
|
157
|
+
/**
|
|
158
|
+
* Инициализация сцены предпросмотра.
|
|
159
|
+
* @param canvas - HTMLCanvasElement для рендеринга
|
|
160
|
+
*/
|
|
161
|
+
constructor(canvas: HTMLCanvasElement);
|
|
162
|
+
/**
|
|
163
|
+
* Обновление состояния рендерера.
|
|
164
|
+
*/
|
|
165
|
+
protected update(): void;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Абстрактный базовый класс рендерера для работы с WebGL через OGL.
|
|
170
|
+
* Отвечает за инициализацию сцены, камеры и цикла рендеринга.
|
|
171
|
+
* @public
|
|
172
|
+
*/
|
|
173
|
+
export declare abstract class Renderer {
|
|
174
|
+
/** Экземпляр рендерера OGL */
|
|
175
|
+
protected gl: Renderer_2;
|
|
176
|
+
/** Корневой объект сцены */
|
|
177
|
+
protected scene: Transform;
|
|
178
|
+
/** Камера для сцены */
|
|
179
|
+
protected camera: Camera;
|
|
180
|
+
/** HTML-элемент canvas, на котором рендерится сцена */
|
|
181
|
+
protected canvas: HTMLCanvasElement;
|
|
182
|
+
/** Program для настройки рендеринга моделей */
|
|
183
|
+
protected program: Program;
|
|
184
|
+
/** Массив моделей на сцене */
|
|
185
|
+
protected meshes: Mesh[];
|
|
186
|
+
/**
|
|
187
|
+
* Конструктор рендерера
|
|
188
|
+
* @param canvas - HTMLCanvasElement для рендеринга
|
|
189
|
+
*/
|
|
190
|
+
protected constructor(canvas: HTMLCanvasElement);
|
|
191
|
+
/**
|
|
192
|
+
* Обновляет размер рендерера и камеры при изменении размеров canvas.
|
|
193
|
+
*/
|
|
194
|
+
resize(): void;
|
|
195
|
+
/**
|
|
196
|
+
* Выполняет рендеринг сцены с текущей камерой.
|
|
197
|
+
*/
|
|
198
|
+
protected render(): void;
|
|
199
|
+
/**
|
|
200
|
+
* Метод для обновления логики рендерера.
|
|
201
|
+
*/
|
|
202
|
+
protected update(): void;
|
|
203
|
+
/**
|
|
204
|
+
* Запускает основной цикл рендеринга.
|
|
205
|
+
*/
|
|
206
|
+
loop(): void;
|
|
207
|
+
/**
|
|
208
|
+
* Публичный метод для добавления фигуры.
|
|
209
|
+
* @param figure - Данные фигуры: position, normal, uv
|
|
210
|
+
*/
|
|
211
|
+
addFigure(figure: Figure): Mesh<Geometry, Program>;
|
|
212
|
+
/** Деструктор */
|
|
213
|
+
destroy(): void;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export { }
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { Camera } from 'ogl';
|
|
2
|
+
import { DisplayMode } from '@planara/types';
|
|
3
|
+
import { Figure } from '@planara/types';
|
|
4
|
+
import { Geometry } from 'ogl';
|
|
5
|
+
import { Mesh } from 'ogl';
|
|
6
|
+
import { OGLRenderingContext } from 'ogl';
|
|
7
|
+
import { Program } from 'ogl';
|
|
8
|
+
import { Renderer as Renderer_2 } from 'ogl';
|
|
9
|
+
import { Transform } from 'ogl';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Создаёт или возвращает готовый экземпляр хаба.
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export declare function createAppHub(renderer: Renderer): EditorHub;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Хаб для управления редактированием
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export declare class EditorHub {
|
|
22
|
+
private displayManager;
|
|
23
|
+
constructor(displayManager: IDisplayManager);
|
|
24
|
+
setDisplayMode(mode: DisplayMode): void;
|
|
25
|
+
destroy(): void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Рендерер для редактора.
|
|
30
|
+
* Добавляет сетку, оси координат и поддержку Orbit для управления камерой.
|
|
31
|
+
* Наследуется от базового Renderer.
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export declare class EditorRenderer extends Renderer {
|
|
35
|
+
/** Orbit-контроллер для управления камерой */
|
|
36
|
+
private orbit;
|
|
37
|
+
/** Raycast для подсветки моделей при наведении */
|
|
38
|
+
private raycast;
|
|
39
|
+
/** Курсор мыши для остлеживания наведения на 3D-модель */
|
|
40
|
+
private mouse;
|
|
41
|
+
/** Были ли зарегистрированы обработчики событий для мыши */
|
|
42
|
+
private isEventListenersAdded;
|
|
43
|
+
/**
|
|
44
|
+
* Инициализация сцены редактора.
|
|
45
|
+
* Создает сетку, оси координат и orbit-контроллер.
|
|
46
|
+
* @param canvas - HTMLCanvasElement для рендеринга
|
|
47
|
+
*/
|
|
48
|
+
constructor(canvas: HTMLCanvasElement);
|
|
49
|
+
/* Excluded from this release type: addMesh */
|
|
50
|
+
/* Excluded from this release type: getContext */
|
|
51
|
+
/* Excluded from this release type: removeMesh */
|
|
52
|
+
/* Excluded from this release type: getMeshes */
|
|
53
|
+
/**
|
|
54
|
+
* Обновление состояния рендерера.
|
|
55
|
+
*/
|
|
56
|
+
protected update(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Метод для добавления фигуры.
|
|
59
|
+
* Настройка raycast.
|
|
60
|
+
* @param figure - Данные фигуры: position, normal, uv
|
|
61
|
+
*/
|
|
62
|
+
addFigure(figure: Figure): Mesh<Geometry, Program>;
|
|
63
|
+
/**
|
|
64
|
+
* Обновление uniform uHit для конкретной 3D-модели
|
|
65
|
+
*/
|
|
66
|
+
protected updateHitUniform(mesh: Mesh): void;
|
|
67
|
+
/**
|
|
68
|
+
* Инициализация обработчиков мыши для raycast
|
|
69
|
+
*/
|
|
70
|
+
private initMouseListeners;
|
|
71
|
+
/**
|
|
72
|
+
* Обработчик движения мыши
|
|
73
|
+
*/
|
|
74
|
+
private handleMouseMove;
|
|
75
|
+
/** Деструктор */
|
|
76
|
+
destroy(): void;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Маркерный интерфейс для менеджеров отображения.
|
|
81
|
+
* @public
|
|
82
|
+
*/
|
|
83
|
+
export declare interface IDisplayManager extends IManager {
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Общий интерфейс для всех менеджеров в хабе.
|
|
88
|
+
* Каждый менеджер отвечает за одну фичу.
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
91
|
+
export declare interface IManager {
|
|
92
|
+
/**
|
|
93
|
+
* Выполняет основное действие менеджера.
|
|
94
|
+
*/
|
|
95
|
+
manage(...args: unknown[]): void;
|
|
96
|
+
/**
|
|
97
|
+
* Освобождает ресурсы менеджера.
|
|
98
|
+
*/
|
|
99
|
+
destroy(): void;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** @public */
|
|
103
|
+
export declare class ObjLoader {
|
|
104
|
+
/** Позиции вершин */
|
|
105
|
+
private positions;
|
|
106
|
+
/** Нормали вершин */
|
|
107
|
+
private normals;
|
|
108
|
+
/** UV-координаты (опционально) */
|
|
109
|
+
private uvs;
|
|
110
|
+
private tmpPositions;
|
|
111
|
+
private tmpNormals;
|
|
112
|
+
private tmpUVs;
|
|
113
|
+
/**
|
|
114
|
+
* Загружает OBJ-модель в Figure
|
|
115
|
+
* @param objContent - Строка содержимого .obj файла
|
|
116
|
+
*/
|
|
117
|
+
load(objContent: string): Figure;
|
|
118
|
+
/**
|
|
119
|
+
* Обрабатывает строку face (f) и разворачивает индексы в массивы для рендеринга
|
|
120
|
+
*/
|
|
121
|
+
private processFaceLine;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* Excluded from this release type: PreviewRenderer */
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Абстрактный базовый класс рендерера для работы с WebGL через OGL.
|
|
128
|
+
* Отвечает за инициализацию сцены, камеры и цикла рендеринга.
|
|
129
|
+
* @public
|
|
130
|
+
*/
|
|
131
|
+
export declare abstract class Renderer {
|
|
132
|
+
/** Экземпляр рендерера OGL */
|
|
133
|
+
protected gl: Renderer_2;
|
|
134
|
+
/** Корневой объект сцены */
|
|
135
|
+
protected scene: Transform;
|
|
136
|
+
/** Камера для сцены */
|
|
137
|
+
protected camera: Camera;
|
|
138
|
+
/** HTML-элемент canvas, на котором рендерится сцена */
|
|
139
|
+
protected canvas: HTMLCanvasElement;
|
|
140
|
+
/** Program для настройки рендеринга моделей */
|
|
141
|
+
protected program: Program;
|
|
142
|
+
/** Массив моделей на сцене */
|
|
143
|
+
protected meshes: Mesh[];
|
|
144
|
+
/**
|
|
145
|
+
* Конструктор рендерера
|
|
146
|
+
* @param canvas - HTMLCanvasElement для рендеринга
|
|
147
|
+
*/
|
|
148
|
+
protected constructor(canvas: HTMLCanvasElement);
|
|
149
|
+
/**
|
|
150
|
+
* Обновляет размер рендерера и камеры при изменении размеров canvas.
|
|
151
|
+
*/
|
|
152
|
+
resize(): void;
|
|
153
|
+
/**
|
|
154
|
+
* Выполняет рендеринг сцены с текущей камерой.
|
|
155
|
+
*/
|
|
156
|
+
protected render(): void;
|
|
157
|
+
/**
|
|
158
|
+
* Метод для обновления логики рендерера.
|
|
159
|
+
*/
|
|
160
|
+
protected update(): void;
|
|
161
|
+
/**
|
|
162
|
+
* Запускает основной цикл рендеринга.
|
|
163
|
+
*/
|
|
164
|
+
loop(): void;
|
|
165
|
+
/**
|
|
166
|
+
* Публичный метод для добавления фигуры.
|
|
167
|
+
* @param figure - Данные фигуры: position, normal, uv
|
|
168
|
+
*/
|
|
169
|
+
addFigure(figure: Figure): Mesh<Geometry, Program>;
|
|
170
|
+
/** Деструктор */
|
|
171
|
+
destroy(): void;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export { }
|
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(I,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("ogl")):typeof define=="function"&&define.amd?define(["exports","ogl"],E):(I=typeof globalThis<"u"?globalThis:I||self,E(I.PlanaraCore={},I.OGL))})(this,(function(I,E){"use strict";var de=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},pe={};/*! *****************************************************************************
|
|
2
|
+
Copyright (C) Microsoft. All rights reserved.
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
4
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
5
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
8
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
9
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
10
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
11
|
+
|
|
12
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
13
|
+
and limitations under the License.
|
|
14
|
+
***************************************************************************** */var ve;function Le(){if(ve)return pe;ve=1;var t;return(function(e){(function(r){var i=typeof globalThis=="object"?globalThis:typeof de=="object"?de:typeof self=="object"?self:typeof this=="object"?this:w(),a=o(e);typeof i.Reflect<"u"&&(a=o(i.Reflect,a)),r(a,i),typeof i.Reflect>"u"&&(i.Reflect=e);function o(v,b){return function(A,G){Object.defineProperty(v,A,{configurable:!0,writable:!0,value:G}),b&&b(A,G)}}function f(){try{return Function("return this;")()}catch{}}function g(){try{return(0,eval)("(function() { return this; })()")}catch{}}function w(){return f()||g()}})(function(r,i){var a=Object.prototype.hasOwnProperty,o=typeof Symbol=="function",f=o&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",g=o&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",w=typeof Object.create=="function",v={__proto__:[]}instanceof Array,b=!w&&!v,A={create:w?function(){return he(Object.create(null))}:v?function(){return he({__proto__:null})}:function(){return he({})},has:b?function(n,s){return a.call(n,s)}:function(n,s){return s in n},get:b?function(n,s){return a.call(n,s)?n[s]:void 0}:function(n,s){return n[s]}},G=Object.getPrototypeOf(Function),V=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:$t(),oe=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:qt(),ue=typeof WeakMap=="function"?WeakMap:Bt(),H=o?Symbol.for("@reflect-metadata:registry"):void 0,Z=Wt(),be=zt(Z);function Ot(n,s,u,l){if(m(u)){if(!Ae(n))throw new TypeError;if(!De(s))throw new TypeError;return xt(n,s)}else{if(!Ae(n))throw new TypeError;if(!S(s))throw new TypeError;if(!S(l)&&!m(l)&&!N(l))throw new TypeError;return N(l)&&(l=void 0),u=k(u),jt(n,s,u,l)}}r("decorate",Ot);function Pt(n,s){function u(l,y){if(!S(l))throw new TypeError;if(!m(y)&&!Gt(y))throw new TypeError;Ee(n,s,l,y)}return u}r("metadata",Pt);function Et(n,s,u,l){if(!S(u))throw new TypeError;return m(l)||(l=k(l)),Ee(n,s,u,l)}r("defineMetadata",Et);function St(n,s,u){if(!S(s))throw new TypeError;return m(u)||(u=k(u)),Re(n,s,u)}r("hasMetadata",St);function Ct(n,s,u){if(!S(s))throw new TypeError;return m(u)||(u=k(u)),le(n,s,u)}r("hasOwnMetadata",Ct);function It(n,s,u){if(!S(s))throw new TypeError;return m(u)||(u=k(u)),Oe(n,s,u)}r("getMetadata",It);function Tt(n,s,u){if(!S(s))throw new TypeError;return m(u)||(u=k(u)),Pe(n,s,u)}r("getOwnMetadata",Tt);function At(n,s){if(!S(n))throw new TypeError;return m(s)||(s=k(s)),Se(n,s)}r("getMetadataKeys",At);function Dt(n,s){if(!S(n))throw new TypeError;return m(s)||(s=k(s)),Ce(n,s)}r("getOwnMetadataKeys",Dt);function kt(n,s,u){if(!S(s))throw new TypeError;if(m(u)||(u=k(u)),!S(s))throw new TypeError;m(u)||(u=k(u));var l=W(s,u,!1);return m(l)?!1:l.OrdinaryDeleteMetadata(n,s,u)}r("deleteMetadata",kt);function xt(n,s){for(var u=n.length-1;u>=0;--u){var l=n[u],y=l(s);if(!m(y)&&!N(y)){if(!De(y))throw new TypeError;s=y}}return s}function jt(n,s,u,l){for(var y=n.length-1;y>=0;--y){var O=n[y],C=O(s,u,l);if(!m(C)&&!N(C)){if(!S(C))throw new TypeError;l=C}}return l}function Re(n,s,u){var l=le(n,s,u);if(l)return!0;var y=ce(s);return N(y)?!1:Re(n,y,u)}function le(n,s,u){var l=W(s,u,!1);return m(l)?!1:Te(l.OrdinaryHasOwnMetadata(n,s,u))}function Oe(n,s,u){var l=le(n,s,u);if(l)return Pe(n,s,u);var y=ce(s);if(!N(y))return Oe(n,y,u)}function Pe(n,s,u){var l=W(s,u,!1);if(!m(l))return l.OrdinaryGetOwnMetadata(n,s,u)}function Ee(n,s,u,l){var y=W(u,l,!0);y.OrdinaryDefineOwnMetadata(n,s,u,l)}function Se(n,s){var u=Ce(n,s),l=ce(n);if(l===null)return u;var y=Se(l,s);if(y.length<=0)return u;if(u.length<=0)return y;for(var O=new oe,C=[],M=0,c=u;M<c.length;M++){var h=c[M],d=O.has(h);d||(O.add(h),C.push(h))}for(var p=0,_=y;p<_.length;p++){var h=_[p],d=O.has(h);d||(O.add(h),C.push(h))}return C}function Ce(n,s){var u=W(n,s,!1);return u?u.OrdinaryOwnMetadataKeys(n,s):[]}function Ie(n){if(n===null)return 1;switch(typeof n){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return n===null?1:6;default:return 6}}function m(n){return n===void 0}function N(n){return n===null}function Ht(n){return typeof n=="symbol"}function S(n){return typeof n=="object"?n!==null:typeof n=="function"}function Nt(n,s){switch(Ie(n)){case 0:return n;case 1:return n;case 2:return n;case 3:return n;case 4:return n;case 5:return n}var u="string",l=ke(n,f);if(l!==void 0){var y=l.call(n,u);if(S(y))throw new TypeError;return y}return Ft(n)}function Ft(n,s){var u,l,y;{var O=n.toString;if(J(O)){var l=O.call(n);if(!S(l))return l}var u=n.valueOf;if(J(u)){var l=u.call(n);if(!S(l))return l}}throw new TypeError}function Te(n){return!!n}function Lt(n){return""+n}function k(n){var s=Nt(n);return Ht(s)?s:Lt(s)}function Ae(n){return Array.isArray?Array.isArray(n):n instanceof Object?n instanceof Array:Object.prototype.toString.call(n)==="[object Array]"}function J(n){return typeof n=="function"}function De(n){return typeof n=="function"}function Gt(n){switch(Ie(n)){case 3:return!0;case 4:return!0;default:return!1}}function fe(n,s){return n===s||n!==n&&s!==s}function ke(n,s){var u=n[s];if(u!=null){if(!J(u))throw new TypeError;return u}}function xe(n){var s=ke(n,g);if(!J(s))throw new TypeError;var u=s.call(n);if(!S(u))throw new TypeError;return u}function je(n){return n.value}function He(n){var s=n.next();return s.done?!1:s}function Ne(n){var s=n.return;s&&s.call(n)}function ce(n){var s=Object.getPrototypeOf(n);if(typeof n!="function"||n===G||s!==G)return s;var u=n.prototype,l=u&&Object.getPrototypeOf(u);if(l==null||l===Object.prototype)return s;var y=l.constructor;return typeof y!="function"||y===n?s:y}function Vt(){var n;!m(H)&&typeof i.Reflect<"u"&&!(H in i.Reflect)&&typeof i.Reflect.defineMetadata=="function"&&(n=Ut(i.Reflect));var s,u,l,y=new ue,O={registerProvider:C,getProvider:c,setProvider:d};return O;function C(p){if(!Object.isExtensible(O))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case n===p:break;case m(s):s=p;break;case s===p:break;case m(u):u=p;break;case u===p:break;default:l===void 0&&(l=new oe),l.add(p);break}}function M(p,_){if(!m(s)){if(s.isProviderFor(p,_))return s;if(!m(u)){if(u.isProviderFor(p,_))return s;if(!m(l))for(var R=xe(l);;){var P=He(R);if(!P)return;var D=je(P);if(D.isProviderFor(p,_))return Ne(R),D}}}if(!m(n)&&n.isProviderFor(p,_))return n}function c(p,_){var R=y.get(p),P;return m(R)||(P=R.get(_)),m(P)&&(P=M(p,_),m(P)||(m(R)&&(R=new V,y.set(p,R)),R.set(_,P))),P}function h(p){if(m(p))throw new TypeError;return s===p||u===p||!m(l)&&l.has(p)}function d(p,_,R){if(!h(R))throw new Error("Metadata provider not registered.");var P=c(p,_);if(P!==R){if(!m(P))return!1;var D=y.get(p);m(D)&&(D=new V,y.set(p,D)),D.set(_,R)}return!0}}function Wt(){var n;return!m(H)&&S(i.Reflect)&&Object.isExtensible(i.Reflect)&&(n=i.Reflect[H]),m(n)&&(n=Vt()),!m(H)&&S(i.Reflect)&&Object.isExtensible(i.Reflect)&&Object.defineProperty(i.Reflect,H,{enumerable:!1,configurable:!1,writable:!1,value:n}),n}function zt(n){var s=new ue,u={isProviderFor:function(h,d){var p=s.get(h);return m(p)?!1:p.has(d)},OrdinaryDefineOwnMetadata:C,OrdinaryHasOwnMetadata:y,OrdinaryGetOwnMetadata:O,OrdinaryOwnMetadataKeys:M,OrdinaryDeleteMetadata:c};return Z.registerProvider(u),u;function l(h,d,p){var _=s.get(h),R=!1;if(m(_)){if(!p)return;_=new V,s.set(h,_),R=!0}var P=_.get(d);if(m(P)){if(!p)return;if(P=new V,_.set(d,P),!n.setProvider(h,d,u))throw _.delete(d),R&&s.delete(h),new Error("Wrong provider for target.")}return P}function y(h,d,p){var _=l(d,p,!1);return m(_)?!1:Te(_.has(h))}function O(h,d,p){var _=l(d,p,!1);if(!m(_))return _.get(h)}function C(h,d,p,_){var R=l(p,_,!0);R.set(h,d)}function M(h,d){var p=[],_=l(h,d,!1);if(m(_))return p;for(var R=_.keys(),P=xe(R),D=0;;){var Fe=He(P);if(!Fe)return p.length=D,p;var Zt=je(Fe);try{p[D]=Zt}catch(Jt){try{Ne(P)}finally{throw Jt}}D++}}function c(h,d,p){var _=l(d,p,!1);if(m(_)||!_.delete(h))return!1;if(_.size===0){var R=s.get(d);m(R)||(R.delete(p),R.size===0&&s.delete(R))}return!0}}function Ut(n){var s=n.defineMetadata,u=n.hasOwnMetadata,l=n.getOwnMetadata,y=n.getOwnMetadataKeys,O=n.deleteMetadata,C=new ue,M={isProviderFor:function(c,h){var d=C.get(c);return!m(d)&&d.has(h)?!0:y(c,h).length?(m(d)&&(d=new oe,C.set(c,d)),d.add(h),!0):!1},OrdinaryDefineOwnMetadata:s,OrdinaryHasOwnMetadata:u,OrdinaryGetOwnMetadata:l,OrdinaryOwnMetadataKeys:y,OrdinaryDeleteMetadata:O};return M}function W(n,s,u){var l=Z.getProvider(n,s);if(!m(l))return l;if(u){if(Z.setProvider(n,s,be))return be;throw new Error("Illegal state.")}}function $t(){var n={},s=[],u=(function(){function M(c,h,d){this._index=0,this._keys=c,this._values=h,this._selector=d}return M.prototype["@@iterator"]=function(){return this},M.prototype[g]=function(){return this},M.prototype.next=function(){var c=this._index;if(c>=0&&c<this._keys.length){var h=this._selector(this._keys[c],this._values[c]);return c+1>=this._keys.length?(this._index=-1,this._keys=s,this._values=s):this._index++,{value:h,done:!1}}return{value:void 0,done:!0}},M.prototype.throw=function(c){throw this._index>=0&&(this._index=-1,this._keys=s,this._values=s),c},M.prototype.return=function(c){return this._index>=0&&(this._index=-1,this._keys=s,this._values=s),{value:c,done:!0}},M})(),l=(function(){function M(){this._keys=[],this._values=[],this._cacheKey=n,this._cacheIndex=-2}return Object.defineProperty(M.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),M.prototype.has=function(c){return this._find(c,!1)>=0},M.prototype.get=function(c){var h=this._find(c,!1);return h>=0?this._values[h]:void 0},M.prototype.set=function(c,h){var d=this._find(c,!0);return this._values[d]=h,this},M.prototype.delete=function(c){var h=this._find(c,!1);if(h>=0){for(var d=this._keys.length,p=h+1;p<d;p++)this._keys[p-1]=this._keys[p],this._values[p-1]=this._values[p];return this._keys.length--,this._values.length--,fe(c,this._cacheKey)&&(this._cacheKey=n,this._cacheIndex=-2),!0}return!1},M.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=n,this._cacheIndex=-2},M.prototype.keys=function(){return new u(this._keys,this._values,y)},M.prototype.values=function(){return new u(this._keys,this._values,O)},M.prototype.entries=function(){return new u(this._keys,this._values,C)},M.prototype["@@iterator"]=function(){return this.entries()},M.prototype[g]=function(){return this.entries()},M.prototype._find=function(c,h){if(!fe(this._cacheKey,c)){this._cacheIndex=-1;for(var d=0;d<this._keys.length;d++)if(fe(this._keys[d],c)){this._cacheIndex=d;break}}return this._cacheIndex<0&&h&&(this._cacheIndex=this._keys.length,this._keys.push(c),this._values.push(void 0)),this._cacheIndex},M})();return l;function y(M,c){return M}function O(M,c){return c}function C(M,c){return[M,c]}}function qt(){var n=(function(){function s(){this._map=new V}return Object.defineProperty(s.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),s.prototype.has=function(u){return this._map.has(u)},s.prototype.add=function(u){return this._map.set(u,u),this},s.prototype.delete=function(u){return this._map.delete(u)},s.prototype.clear=function(){this._map.clear()},s.prototype.keys=function(){return this._map.keys()},s.prototype.values=function(){return this._map.keys()},s.prototype.entries=function(){return this._map.entries()},s.prototype["@@iterator"]=function(){return this.keys()},s.prototype[g]=function(){return this.keys()},s})();return n}function Bt(){var n=16,s=A.create(),u=l();return(function(){function c(){this._key=l()}return c.prototype.has=function(h){var d=y(h,!1);return d!==void 0?A.has(d,this._key):!1},c.prototype.get=function(h){var d=y(h,!1);return d!==void 0?A.get(d,this._key):void 0},c.prototype.set=function(h,d){var p=y(h,!0);return p[this._key]=d,this},c.prototype.delete=function(h){var d=y(h,!1);return d!==void 0?delete d[this._key]:!1},c.prototype.clear=function(){this._key=l()},c})();function l(){var c;do c="@@WeakMap@@"+M();while(A.has(s,c));return s[c]=!0,c}function y(c,h){if(!a.call(c,u)){if(!h)return;Object.defineProperty(c,u,{value:A.create()})}return c[u]}function O(c,h){for(var d=0;d<h;++d)c[d]=Math.random()*255|0;return c}function C(c){if(typeof Uint8Array=="function"){var h=new Uint8Array(c);return typeof crypto<"u"?crypto.getRandomValues(h):typeof msCrypto<"u"?msCrypto.getRandomValues(h):O(h,c),h}return O(new Array(c),c)}function M(){var c=C(n);c[6]=c[6]&79|64,c[8]=c[8]&191|128;for(var h="",d=0;d<n;++d){var p=c[d];(d===4||d===6||d===8)&&(h+="-"),p<16&&(h+="0"),h+=p.toString(16).toLowerCase()}return h}}function he(n){return n.__=void 0,delete n.__,n}})})(t||(t={})),pe}Le();function Ge(t){const e=`
|
|
2
15
|
attribute vec3 position;
|
|
3
16
|
attribute vec3 normal;
|
|
4
17
|
|
|
@@ -12,7 +25,7 @@
|
|
|
12
25
|
vNormal = normalize(normalMatrix * normal);
|
|
13
26
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
14
27
|
}
|
|
15
|
-
`,
|
|
28
|
+
`,r=`
|
|
16
29
|
precision highp float;
|
|
17
30
|
|
|
18
31
|
uniform float uHit;
|
|
@@ -26,5 +39,20 @@
|
|
|
26
39
|
gl_FragColor.rgb = color + lighting * 0.1;
|
|
27
40
|
gl_FragColor.a = 1.0;
|
|
28
41
|
}
|
|
29
|
-
`;return new
|
|
30
|
-
|
|
42
|
+
`;return new E.Program(t,{vertex:e,fragment:r,cullFace:!1,uniforms:{uHit:{value:0}}})}class Y{gl;scene;camera;canvas;program;meshes;constructor(e){this.canvas=e,this.gl=new E.Renderer({canvas:e,dpr:2}),this.gl.setSize(e.clientWidth,e.clientHeight),this.gl.gl.clearColor(.1,.1,.1,1),this.scene=new E.Transform,this.camera=new E.Camera(this.gl.gl,{fov:45}),this.camera.position.set(1,1,7),this.camera.lookAt([0,0,0]),this.program=Ge(this.gl.gl),this.meshes=[]}resize(){this.gl.setSize(this.canvas.width,this.canvas.height),this.camera.perspective({aspect:this.canvas.width/this.canvas.height})}render(){this.gl.render({scene:this.scene,camera:this.camera})}update(){}loop(){this.update(),this.render(),requestAnimationFrame(this.loop.bind(this))}addFigure(e){const r=new E.Geometry(this.gl.gl,{position:{size:3,data:new Float32Array(e.position)},normal:{size:3,data:new Float32Array(e.normal??[])},uv:{size:2,data:new Float32Array(e.uv??[])}}),i=new E.Mesh(this.gl.gl,{geometry:r,program:this.program});return i.setParent(this.scene),this.meshes.push(i),i}destroy(){this.meshes&&(this.meshes.length=0,this.meshes=[]),this.scene=null,this.camera=null,this.program=null,this.gl=null,this.canvas=null}}class Ve extends E.Orbit{isInteracting=!1;element;constructor(e,r={}){super(e,r),this.element=r.element||document,this.element.addEventListener("mousedown",()=>this.isInteracting=!0),this.element.addEventListener("mouseup",()=>this.isInteracting=!1),this.element.addEventListener("touchstart",()=>this.isInteracting=!0),this.element.addEventListener("touchend",()=>this.isInteracting=!1)}destroy(){this.element.removeEventListener("mousedown",()=>this.isInteracting=!0),this.element.removeEventListener("mouseup",()=>this.isInteracting=!1),this.element.removeEventListener("touchstart",()=>this.isInteracting=!0),this.element.removeEventListener("touchend",()=>this.isInteracting=!1)}}var Q;(function(t){t[t.Transient=0]="Transient",t[t.Singleton=1]="Singleton",t[t.ResolutionScoped=2]="ResolutionScoped",t[t.ContainerScoped=3]="ContainerScoped"})(Q||(Q={}));const T=Q;/*! *****************************************************************************
|
|
43
|
+
Copyright (c) Microsoft Corporation.
|
|
44
|
+
|
|
45
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
46
|
+
purpose with or without fee is hereby granted.
|
|
47
|
+
|
|
48
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
49
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
50
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
51
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
52
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
53
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
54
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
55
|
+
***************************************************************************** */var X=function(t,e){return X=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)i.hasOwnProperty(a)&&(r[a]=i[a])},X(t,e)};function K(t,e){X(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function We(t,e,r,i){function a(o){return o instanceof r?o:new r(function(f){f(o)})}return new(r||(r=Promise))(function(o,f){function g(b){try{v(i.next(b))}catch(A){f(A)}}function w(b){try{v(i.throw(b))}catch(A){f(A)}}function v(b){b.done?o(b.value):a(b.value).then(g,w)}v((i=i.apply(t,[])).next())})}function ze(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,a,o,f;return f={next:g(0),throw:g(1),return:g(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function g(v){return function(b){return w([v,b])}}function w(v){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,a&&(o=v[0]&2?a.return:v[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,v[1])).done)return o;switch(a=0,o&&(v=[v[0]&2,o.value]),v[0]){case 0:case 1:o=v;break;case 4:return r.label++,{value:v[1],done:!1};case 5:r.label++,a=v[1],v=[0];continue;case 7:v=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(v[0]===6||v[0]===2)){r=0;continue}if(v[0]===3&&(!o||v[1]>o[0]&&v[1]<o[3])){r.label=v[1];break}if(v[0]===6&&r.label<o[1]){r.label=o[1],o=v;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(v);break}o[2]&&r.ops.pop(),r.trys.pop();continue}v=e.call(t,r)}catch(b){v=[6,b],a=0}finally{i=o=0}if(v[0]&5)throw v[1];return{value:v[0]?v[1]:void 0,done:!0}}}function z(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function U(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var i=r.call(t),a,o=[],f;try{for(;(e===void 0||e-- >0)&&!(a=i.next()).done;)o.push(a.value)}catch(g){f={error:g}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(f)throw f.error}}return o}function x(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(U(arguments[e]));return t}var ee="injectionTokens";function Ue(t){var e=Reflect.getMetadata("design:paramtypes",t)||[],r=Reflect.getOwnMetadata(ee,t)||{};return Object.keys(r).forEach(function(i){e[+i]=r[i]}),e}function ye(t,e){return function(r,i,a){var o=Reflect.getOwnMetadata(ee,r)||{};o[a]=t,Reflect.defineMetadata(ee,o,r)}}function me(t){return!!t.useClass}function te(t){return!!t.useFactory}var ge=(function(){function t(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return t.prototype.createProxy=function(e){var r=this,i={},a=!1,o,f=function(){return a||(o=e(r.wrap()),a=!0),o};return new Proxy(i,this.createHandler(f))},t.prototype.createHandler=function(e){var r={},i=function(a){r[a]=function(){for(var o=[],f=0;f<arguments.length;f++)o[f]=arguments[f];o[0]=e();var g=Reflect[a];return g.apply(void 0,x(o))}};return this.reflectMethods.forEach(i),r},t})();function j(t){return typeof t=="string"||typeof t=="symbol"}function $e(t){return typeof t=="object"&&"token"in t&&"multiple"in t}function we(t){return typeof t=="object"&&"token"in t&&"transform"in t}function qe(t){return typeof t=="function"||t instanceof ge}function $(t){return!!t.useToken}function q(t){return t.useValue!=null}function Be(t){return me(t)||q(t)||$(t)||te(t)}var re=(function(){function t(){this._registryMap=new Map}return t.prototype.entries=function(){return this._registryMap.entries()},t.prototype.getAll=function(e){return this.ensure(e),this._registryMap.get(e)},t.prototype.get=function(e){this.ensure(e);var r=this._registryMap.get(e);return r[r.length-1]||null},t.prototype.set=function(e,r){this.ensure(e),this._registryMap.get(e).push(r)},t.prototype.setAll=function(e,r){this._registryMap.set(e,r)},t.prototype.has=function(e){return this.ensure(e),this._registryMap.get(e).length>0},t.prototype.clear=function(){this._registryMap.clear()},t.prototype.ensure=function(e){this._registryMap.has(e)||this._registryMap.set(e,[])},t})(),Ze=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(re),B=(function(){function t(){this.scopedResolutions=new Map}return t})();function Je(t,e){if(t===null)return"at position #"+e;var r=t.split(",")[e].trim();return'"'+r+'" at position #'+e}function Ye(t,e,r){return r===void 0&&(r=" "),x([t],e.message.split(`
|
|
56
|
+
`).map(function(i){return r+i})).join(`
|
|
57
|
+
`)}function Qe(t,e,r){var i=U(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2),a=i[1],o=a===void 0?null:a,f=Je(o,e);return Ye("Cannot inject the dependency "+f+' of "'+t.name+'" constructor. Reason:',r)}function Xe(t){if(typeof t.dispose!="function")return!1;var e=t.dispose;return!(e.length>0)}var Ke=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(re),et=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(re),tt=(function(){function t(){this.preResolution=new Ke,this.postResolution=new et}return t})(),Me=new Map,rt=(function(){function t(e){this.parent=e,this._registry=new Ze,this.interceptors=new tt,this.disposed=!1,this.disposables=new Set}return t.prototype.register=function(e,r,i){i===void 0&&(i={lifecycle:T.Transient}),this.ensureNotDisposed();var a;if(Be(r)?a=r:a={useClass:r},$(a))for(var o=[e],f=a;f!=null;){var g=f.useToken;if(o.includes(g))throw new Error("Token registration cycle detected! "+x(o,[g]).join(" -> "));o.push(g);var w=this._registry.get(g);w&&$(w.provider)?f=w.provider:f=null}if((i.lifecycle===T.Singleton||i.lifecycle==T.ContainerScoped||i.lifecycle==T.ResolutionScoped)&&(q(a)||te(a)))throw new Error('Cannot use lifecycle "'+T[i.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:a,options:i}),this},t.prototype.registerType=function(e,r){return this.ensureNotDisposed(),j(r)?this.register(e,{useToken:r}):this.register(e,{useClass:r})},t.prototype.registerInstance=function(e,r){return this.ensureNotDisposed(),this.register(e,{useValue:r})},t.prototype.registerSingleton=function(e,r){if(this.ensureNotDisposed(),j(e)){if(j(r))return this.register(e,{useToken:r},{lifecycle:T.Singleton});if(r)return this.register(e,{useClass:r},{lifecycle:T.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var i=e;return r&&!j(r)&&(i=r),this.register(e,{useClass:i},{lifecycle:T.Singleton})},t.prototype.resolve=function(e,r,i){r===void 0&&(r=new B),i===void 0&&(i=!1),this.ensureNotDisposed();var a=this.getRegistration(e);if(!a&&j(e)){if(i)return;throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"Single"),a){var o=this.resolveRegistration(a,r);return this.executePostResolutionInterceptor(e,o,"Single"),o}if(qe(e)){var o=this.construct(e,r);return this.executePostResolutionInterceptor(e,o,"Single"),o}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},t.prototype.executePreResolutionInterceptor=function(e,r){var i,a;if(this.interceptors.preResolution.has(e)){var o=[];try{for(var f=z(this.interceptors.preResolution.getAll(e)),g=f.next();!g.done;g=f.next()){var w=g.value;w.options.frequency!="Once"&&o.push(w),w.callback(e,r)}}catch(v){i={error:v}}finally{try{g&&!g.done&&(a=f.return)&&a.call(f)}finally{if(i)throw i.error}}this.interceptors.preResolution.setAll(e,o)}},t.prototype.executePostResolutionInterceptor=function(e,r,i){var a,o;if(this.interceptors.postResolution.has(e)){var f=[];try{for(var g=z(this.interceptors.postResolution.getAll(e)),w=g.next();!w.done;w=g.next()){var v=w.value;v.options.frequency!="Once"&&f.push(v),v.callback(e,r,i)}}catch(b){a={error:b}}finally{try{w&&!w.done&&(o=g.return)&&o.call(g)}finally{if(a)throw a.error}}this.interceptors.postResolution.setAll(e,f)}},t.prototype.resolveRegistration=function(e,r){if(this.ensureNotDisposed(),e.options.lifecycle===T.ResolutionScoped&&r.scopedResolutions.has(e))return r.scopedResolutions.get(e);var i=e.options.lifecycle===T.Singleton,a=e.options.lifecycle===T.ContainerScoped,o=i||a,f;return q(e.provider)?f=e.provider.useValue:$(e.provider)?f=o?e.instance||(e.instance=this.resolve(e.provider.useToken,r)):this.resolve(e.provider.useToken,r):me(e.provider)?f=o?e.instance||(e.instance=this.construct(e.provider.useClass,r)):this.construct(e.provider.useClass,r):te(e.provider)?f=e.provider.useFactory(this):f=this.construct(e.provider,r),e.options.lifecycle===T.ResolutionScoped&&r.scopedResolutions.set(e,f),f},t.prototype.resolveAll=function(e,r,i){var a=this;r===void 0&&(r=new B),i===void 0&&(i=!1),this.ensureNotDisposed();var o=this.getAllRegistrations(e);if(!o&&j(e)){if(i)return[];throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"All"),o){var f=o.map(function(w){return a.resolveRegistration(w,r)});return this.executePostResolutionInterceptor(e,f,"All"),f}var g=[this.construct(e,r)];return this.executePostResolutionInterceptor(e,g,"All"),g},t.prototype.isRegistered=function(e,r){return r===void 0&&(r=!1),this.ensureNotDisposed(),this._registry.has(e)||r&&(this.parent||!1)&&this.parent.isRegistered(e,!0)},t.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},t.prototype.clearInstances=function(){var e,r;this.ensureNotDisposed();try{for(var i=z(this._registry.entries()),a=i.next();!a.done;a=i.next()){var o=U(a.value,2),f=o[0],g=o[1];this._registry.setAll(f,g.filter(function(w){return!q(w.provider)}).map(function(w){return w.instance=void 0,w}))}}catch(w){e={error:w}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},t.prototype.createChildContainer=function(){var e,r;this.ensureNotDisposed();var i=new t(this);try{for(var a=z(this._registry.entries()),o=a.next();!o.done;o=a.next()){var f=U(o.value,2),g=f[0],w=f[1];w.some(function(v){var b=v.options;return b.lifecycle===T.ContainerScoped})&&i._registry.setAll(g,w.map(function(v){return v.options.lifecycle===T.ContainerScoped?{provider:v.provider,options:v.options}:v}))}}catch(v){e={error:v}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}return i},t.prototype.beforeResolution=function(e,r,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:r,options:i})},t.prototype.afterResolution=function(e,r,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:r,options:i})},t.prototype.dispose=function(){return We(this,void 0,void 0,function(){var e;return ze(this,function(r){switch(r.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(i){var a=i.dispose();a&&e.push(a)}),[4,Promise.all(e)];case 1:return r.sent(),[2]}})})},t.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},t.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},t.prototype.construct=function(e,r){var i=this;if(e instanceof ge)return e.createProxy(function(o){return i.resolve(o,r)});var a=(function(){var o=Me.get(e);if(!o||o.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var f=o.map(i.resolveParams(r,e));return new(e.bind.apply(e,x([void 0],f)))})();return Xe(a)&&this.disposables.add(a),a},t.prototype.resolveParams=function(e,r){var i=this;return function(a,o){var f,g,w;try{return $e(a)?we(a)?a.multiple?(f=i.resolve(a.transform)).transform.apply(f,x([i.resolveAll(a.token,new B,a.isOptional)],a.transformArgs)):(g=i.resolve(a.transform)).transform.apply(g,x([i.resolve(a.token,e,a.isOptional)],a.transformArgs)):a.multiple?i.resolveAll(a.token,new B,a.isOptional):i.resolve(a.token,e,a.isOptional):we(a)?(w=i.resolve(a.transform,e)).transform.apply(w,x([i.resolve(a.token,e)],a.transformArgs)):i.resolve(a,e)}catch(v){throw new Error(Qe(r,o,v))}}},t.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},t})(),nt=new rt;function ne(t,e){var r={token:t,multiple:!1,isOptional:e};return ye(r)}function F(t){return function(e){Me.set(e,Ue(e))}}function it(t,e){var r={token:t,multiple:!0,isOptional:e};return ye(r)}if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var st=Object.getOwnPropertyDescriptor,at=(t,e,r,i)=>{for(var a=i>1?void 0:i?st(e,r):e,o=t.length-1,f;o>=0;o--)(f=t[o])&&(a=f(a)||a);return a};I.EditorRenderer=class extends Y{orbit;raycast;mouse;isEventListenersAdded;constructor(e){super(e);const r=new E.GridHelper(this.gl.gl,{size:10,divisions:10});r.position.y=-.001,r.setParent(this.scene),new E.AxesHelper(this.gl.gl,{size:6,symmetric:!0}).setParent(this.scene),this.orbit=new Ve(this.camera,{element:this.canvas}),this.raycast=new E.Raycast,this.mouse=new E.Vec2,this.isEventListenersAdded=!1}addMesh(e){this.scene.addChild(e)}getContext(){return this.gl.gl}removeMesh(e){this.scene.removeChild(e)}getMeshes(){return this.meshes}update(){this.orbit?.update()}addFigure(e){const r=super.addFigure(e);if(r.geometry){const i=r.geometry.constructor.name;r.geometry.raycast=i.includes("Sphere")?"sphere":"box"}return r.isHit=!1,r.onBeforeRender(({mesh:i})=>{this.updateHitUniform(i)}),this.isEventListenersAdded||this.initMouseListeners(),r}updateHitUniform(e){this.program.uniforms.uHit.value=e.isHit?1:0}initMouseListeners(){document.addEventListener("mousemove",this.handleMouseMove,!1),this.isEventListenersAdded=!0}handleMouseMove=e=>{if(this.orbit.isInteracting)return;this.mouse.set(2*(e.x/this.gl.width)-1,2*(1-e.y/this.gl.height)-1),this.raycast.castMouse(this.camera,this.mouse),this.meshes.forEach(i=>i.isHit=!1),this.raycast.intersectBounds(this.meshes).forEach(i=>i.isHit=!0)};destroy(){this.isEventListenersAdded&&(window.removeEventListener("mousemove",this.handleMouseMove,!1),this.isEventListenersAdded=!1),this.orbit=null,this.raycast=null,this.mouse=null,super.destroy()}},I.EditorRenderer=at([F()],I.EditorRenderer);class ot extends Y{orbit;constructor(e){super(e),this.orbit=new E.Orbit(this.camera,{element:this.canvas,target:new E.Vec3(0,0,0),minPolarAngle:Math.PI/2,maxPolarAngle:Math.PI/2,enableRotate:!0,enableZoom:!1,enablePan:!1})}update(){this.orbit?.update()}}class ut{type;position;normal;uv;material;constructor(e){this.type=e.type,this.position=e.position,this.normal=e.normal??[],this.uv=e.uv??[],this.material=e.material}}var _e=(t=>(t[t.Cube=0]="Cube",t[t.Sphere=1]="Sphere",t[t.Plane=2]="Plane",t[t.Cylinder=3]="Cylinder",t[t.Custom=4]="Custom",t))(_e||{}),L=(t=>(t.Plane="plane",t.Wireframe="wireframe",t.Texture="texture",t))(L||{});class lt{positions=[];normals=[];uvs=[];tmpPositions=[];tmpNormals=[];tmpUVs=[];load(e){const r=e.split(`
|
|
58
|
+
`);for(const a of r){if(!a.trim()||a.startsWith("#"))continue;const o=a.trim().split(/\s+/);switch(o[0]){case"v":this.tmpPositions.push(o.slice(1).map(Number));break;case"vn":this.tmpNormals.push(o.slice(1).map(Number));break;case"vt":this.tmpUVs.push(o.slice(1).map(Number));break;case"f":this.processFaceLine(o);break}}const i={type:_e.Custom,position:this.positions,...this.normals.length>0&&{normal:this.normals},...this.uvs.length>0&&{uv:this.uvs}};return new ut(i)}processFaceLine(e){for(let r=1;r<e.length;r++){const i=e[r];if(!i)continue;const[a,o,f]=i.split("/"),g=a?parseInt(a,10):void 0,w=o?parseInt(o,10):void 0,v=f?parseInt(f,10):void 0;if(g!==void 0){const b=this.tmpPositions[g-1];b&&this.positions.push(...b)}if(w!==void 0){const b=this.tmpUVs[w-1];b&&this.uvs.push(...b)}if(v!==void 0){const b=this.tmpNormals[v-1];b&&this.normals.push(...b)}}}}var ft=Object.getOwnPropertyDescriptor,ct=(t,e,r,i)=>{for(var a=i>1?void 0:i?ft(e,r):e,o=t.length-1,f;o>=0;o--)(f=t[o])&&(a=f(a)||a);return a},ht=(t,e)=>(r,i)=>e(r,i,t);let ie=class{currentMode=L.Plane;handlers;constructor(t){this.handlers=new Map(t.map(e=>[e.mode,e]))}manage(t){t!==this.currentMode&&(this.handlers.get(this.currentMode)?.rollback(),t!==L.Plane&&this.handlers.get(t)?.handle(),this.currentMode=t)}destroy(){this.handlers&&this.handlers.clear(),this.currentMode=L.Plane}};ie=ct([F(),ht(0,it("IDisplayHandler"))],ie);var dt=Object.getOwnPropertyDescriptor,pt=(t,e,r,i)=>{for(var a=i>1?void 0:i?dt(e,r):e,o=t.length-1,f;o>=0;o--)(f=t[o])&&(a=f(a)||a);return a},vt=(t,e)=>(r,i)=>e(r,i,t);let se=class{constructor(t){this.api=t,this.wireMeshes=[],this.context=this.api.getContext(),this.wireMeshProgram=new E.NormalProgram(this.context)}mode=L.Wireframe;wireMeshes;wireMeshProgram;context;handle(){const t=this.api.getMeshes();this.createWireMeshes(t),this.api.removeMeshes(t),this.api.addMeshes(this.wireMeshes)}rollback(){const t=this.api.getMeshes();this.api.removeMeshes(this.wireMeshes),this.api.addMeshes(t)}destroy(){this.wireMeshes&&(this.wireMeshes.length=0,this.wireMeshes=[])}createWireMeshes(t){for(const e of t){const r=new E.WireMesh(this.context,{geometry:e.geometry,program:this.wireMeshProgram});this.wireMeshes.push(r)}}};se=pt([F(),vt(0,ne("RendererApi"))],se);var yt=Object.getOwnPropertyDescriptor,mt=(t,e,r,i)=>{for(var a=i>1?void 0:i?yt(e,r):e,o=t.length-1,f;o>=0;o--)(f=t[o])&&(a=f(a)||a);return a},gt=(t,e)=>(r,i)=>e(r,i,t);let ae=class{constructor(t){this.renderer=t}addMesh(t){this.renderer.addMesh(t)}addMeshes(t){for(const e of t)this.renderer.addMesh(e)}removeMesh(t){this.renderer.removeMesh(t)}removeMeshes(t){for(const e of t)this.renderer.removeMesh(e)}getMeshes(){return this.renderer.getMeshes()}getContext(){return this.renderer.getContext()}};ae=mt([F(),gt(0,ne("EditorRenderer"))],ae);var wt=Object.getOwnPropertyDescriptor,Mt=(t,e,r,i)=>{for(var a=i>1?void 0:i?wt(e,r):e,o=t.length-1,f;o>=0;o--)(f=t[o])&&(a=f(a)||a);return a},_t=(t,e)=>(r,i)=>e(r,i,t);I.EditorHub=class{constructor(e){this.displayManager=e}setDisplayMode(e){this.displayManager.manage(e)}destroy(){this.displayManager.destroy()}},I.EditorHub=Mt([F(),_t(0,ne("IDisplayManager"))],I.EditorHub);function bt(t){const e=nt.createChildContainer();return e.registerInstance("EditorRenderer",t),e.registerSingleton("RendererApi",ae),e.registerSingleton("IDisplayHandler",se),e.registerSingleton("IDisplayManager",ie),e.registerSingleton("EditorHub",I.EditorHub),e}function Rt(t){return bt(t).resolve("EditorHub")}I.ObjLoader=lt,I.PreviewRenderer=ot,I.Renderer=Y,I.createAppHub=Rt,Object.defineProperty(I,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IHandler } from './handler';
|
|
2
|
+
import { DisplayMode } from '@planara/types';
|
|
3
|
+
/**
|
|
4
|
+
* Маркерный интерфейс для всех Display-хендлеров.
|
|
5
|
+
* Используется только для DI.
|
|
6
|
+
*
|
|
7
|
+
* Расширяет {@link IHandler} и добавляет поле `mode`
|
|
8
|
+
*/
|
|
9
|
+
export interface IDisplayHandler extends IHandler {
|
|
10
|
+
mode: DisplayMode;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=display-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display-handler.d.ts","sourceRoot":"","sources":["../../src/interfaces/display-handler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;;;GAKG;AACH,MAAM,WAAW,eAAgB,SAAQ,QAAQ;IAC/C,IAAI,EAAE,WAAW,CAAC;CACnB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Общий интерфейс для всех хендлеров.
|
|
3
|
+
* Хендлеры выполняют действия по настройке рендерера,
|
|
4
|
+
* управляют состоянием сцены или конкретных режимов отображения.
|
|
5
|
+
*/
|
|
6
|
+
export interface IHandler {
|
|
7
|
+
/**
|
|
8
|
+
* Выполняет основное действие хендлера.
|
|
9
|
+
* Например, применяет конкретный режим отображения или модифицирует настройки рендерера.
|
|
10
|
+
*/
|
|
11
|
+
handle(): void;
|
|
12
|
+
/**
|
|
13
|
+
* Откатывает изменения, внесённые методом handle().
|
|
14
|
+
* Используется для восстановления предыдущего состояния рендерера.
|
|
15
|
+
*/
|
|
16
|
+
rollback(): void;
|
|
17
|
+
/**
|
|
18
|
+
* Освобождает ресурсы хендлера, удаляет слушатели и очищает внутренние данные.
|
|
19
|
+
*/
|
|
20
|
+
destroy(): void;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/interfaces/handler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB;;;OAGG;IACH,MAAM,IAAI,IAAI,CAAC;IAEf;;;OAGG;IACH,QAAQ,IAAI,IAAI,CAAC;IAEjB;;OAEG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Общий интерфейс для всех менеджеров в хабе.
|
|
3
|
+
* Каждый менеджер отвечает за одну фичу.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface IManager {
|
|
7
|
+
/**
|
|
8
|
+
* Выполняет основное действие менеджера.
|
|
9
|
+
*/
|
|
10
|
+
manage(...args: unknown[]): void;
|
|
11
|
+
/**
|
|
12
|
+
* Освобождает ресурсы менеджера.
|
|
13
|
+
*/
|
|
14
|
+
destroy(): void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Маркерный интерфейс для менеджеров отображения.
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export interface IDisplayManager extends IManager {
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/interfaces/manager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,MAAM,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEjC;;OAEG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,QAAQ;CAAG"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Mesh } from 'ogl';
|
|
2
|
+
/**
|
|
3
|
+
* Интерфейс для управления фигурами внутри рендерера.
|
|
4
|
+
* Предоставляет базовый CRUD-набор операций для добавления, удаления и получения фигур из сцены.
|
|
5
|
+
*/
|
|
6
|
+
export interface IMeshApi {
|
|
7
|
+
/**
|
|
8
|
+
* Добавляет фигуру в сцену.
|
|
9
|
+
*
|
|
10
|
+
* @param mesh - Фигура, которую необходимо добавить.
|
|
11
|
+
*/
|
|
12
|
+
addMesh(mesh: Mesh): void;
|
|
13
|
+
/**
|
|
14
|
+
* Добавляет несколько фигур в сцену за один вызов.
|
|
15
|
+
*
|
|
16
|
+
* @param meshes - Массив фигур для добавления.
|
|
17
|
+
*/
|
|
18
|
+
addMeshes(meshes: Mesh[]): void;
|
|
19
|
+
/**
|
|
20
|
+
* Удаляет фигуру из сцены.
|
|
21
|
+
*
|
|
22
|
+
* @param mesh - Фигура, которую необходимо удалить.
|
|
23
|
+
*/
|
|
24
|
+
removeMesh(mesh: Mesh): void;
|
|
25
|
+
/**
|
|
26
|
+
* Удаляет несколько фигур из сцены за один вызов.
|
|
27
|
+
*
|
|
28
|
+
* @param meshes - Массив фигур для удаления.
|
|
29
|
+
*/
|
|
30
|
+
removeMeshes(meshes: Mesh[]): void;
|
|
31
|
+
/**
|
|
32
|
+
* Возвращает список всех фигур, находящихся в сцене.
|
|
33
|
+
*
|
|
34
|
+
* @returns Массив текущих фигур.
|
|
35
|
+
*/
|
|
36
|
+
getMeshes(): Mesh[];
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=mesh-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mesh-api.d.ts","sourceRoot":"","sources":["../../src/interfaces/mesh-api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAEhC;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAE1B;;;;OAIG;IACH,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAEhC;;;;OAIG;IACH,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAE7B;;;;OAIG;IACH,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAEnC;;;;OAIG;IACH,SAAS,IAAI,IAAI,EAAE,CAAC;CACrB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { OGLRenderingContext } from 'ogl';
|
|
2
|
+
/**
|
|
3
|
+
* Интерфейс API рендерера.
|
|
4
|
+
* Предоставляет доступ к базовым возможностям ядра рендерера,
|
|
5
|
+
*/
|
|
6
|
+
export interface IRendererApi {
|
|
7
|
+
/**
|
|
8
|
+
* Возвращает WebGL контекст рендерера.
|
|
9
|
+
*
|
|
10
|
+
* @returns Контекст WebGL (OGLRenderingContext) текущей сцены.
|
|
11
|
+
*/
|
|
12
|
+
getContext(): OGLRenderingContext;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=renderer-api.d.ts.map
|