@shopware-ag/dive 1.1.0 → 1.1.2
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/README.md +2 -0
- package/build/dive.cjs +1508 -0
- package/build/dive.cjs.map +1 -0
- package/build/dive.d.cts +559 -0
- package/build/dive.d.ts +559 -0
- package/build/dive.js +1473 -0
- package/build/dive.js.map +1 -0
- package/package.json +1 -1
package/build/dive.d.ts
ADDED
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
import { ShadowMapType, ToneMapping, WebGLRenderer, Scene, Camera, PerspectiveCamera, Vector3Like, Mesh, ColorRepresentation, Object3D } from 'three';
|
|
2
|
+
import { OrbitControls } from 'three/examples/jsm/Addons.js';
|
|
3
|
+
|
|
4
|
+
type DIVERendererSettings = {
|
|
5
|
+
antialias: boolean;
|
|
6
|
+
alpha: boolean;
|
|
7
|
+
stencil: boolean;
|
|
8
|
+
shadowMapEnabled: boolean;
|
|
9
|
+
shadowMapType: ShadowMapType;
|
|
10
|
+
toneMapping: ToneMapping;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* A changed version of the WebGLRenderer.
|
|
14
|
+
*
|
|
15
|
+
* Has to be started manually by calling StartRenderer().
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
declare class DIVERenderer extends WebGLRenderer {
|
|
20
|
+
private paused;
|
|
21
|
+
private running;
|
|
22
|
+
private force;
|
|
23
|
+
private preRenderCallbacks;
|
|
24
|
+
private postRenderCallbacks;
|
|
25
|
+
constructor(rendererSettings?: DIVERendererSettings);
|
|
26
|
+
StartRenderer(scene: Scene, cam: Camera): void;
|
|
27
|
+
PauseRenderer(): void;
|
|
28
|
+
ResumeRenderer(): void;
|
|
29
|
+
StopRenderer(): void;
|
|
30
|
+
OnResize(width: number, height: number): void;
|
|
31
|
+
/**
|
|
32
|
+
* Adds a callback to the render loop before actual render call.
|
|
33
|
+
* @param callback Executed before rendering.
|
|
34
|
+
* @returns uuid to remove the callback.
|
|
35
|
+
*/
|
|
36
|
+
AddPreRenderCallback(callback: () => void): string;
|
|
37
|
+
/**
|
|
38
|
+
* Removes a callback from the render loop before actual render call.
|
|
39
|
+
* @param uuid of callback to remove.
|
|
40
|
+
* @returns if removing was successful.
|
|
41
|
+
*/
|
|
42
|
+
RemovePreRenderCallback(uuid: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Adds a callback to the render loop after actual render call.
|
|
45
|
+
* @param callback Executed after rendering.
|
|
46
|
+
* @returns uuid to remove the callback.
|
|
47
|
+
*/
|
|
48
|
+
AddPostRenderCallback(callback: () => void): string;
|
|
49
|
+
/**
|
|
50
|
+
* Removes a callback from the render loop after actual render call.
|
|
51
|
+
* @param uuid of callback to remove.
|
|
52
|
+
* @returns if removing was successful.
|
|
53
|
+
*/
|
|
54
|
+
RemovePostRenderCallback(uuid: string): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Forces the renderer to render the next frame.
|
|
57
|
+
*/
|
|
58
|
+
ForceRendering(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Internal render loop.
|
|
61
|
+
*
|
|
62
|
+
* To control renderloop you can add callbacks via AddPreRenderCallback() and AddPostRenderCallback().
|
|
63
|
+
* @param scene Scene to render.
|
|
64
|
+
* @param cam Camera to render with.
|
|
65
|
+
*/
|
|
66
|
+
private internal_render;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
type DIVEPerspectiveCameraSettings = {
|
|
70
|
+
fov: number;
|
|
71
|
+
near: number;
|
|
72
|
+
far: number;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* A Perspective camera. Can change the layer mask to show different objects.
|
|
76
|
+
*
|
|
77
|
+
* @module
|
|
78
|
+
*/
|
|
79
|
+
declare class DIVEPerspectiveCamera extends PerspectiveCamera {
|
|
80
|
+
static readonly EDITOR_VIEW_LAYER_MASK: number;
|
|
81
|
+
static readonly LIVE_VIEW_LAYER_MASK = 16;
|
|
82
|
+
onSetCameraLayer: (mask: number) => void;
|
|
83
|
+
constructor(settings?: DIVEPerspectiveCameraSettings);
|
|
84
|
+
OnResize(width: number, height: number): void;
|
|
85
|
+
SetCameraLayer(layer: 'LIVE' | 'EDITOR'): void;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
type DIVEOrbitControlsSettings = {
|
|
89
|
+
enableDamping: boolean;
|
|
90
|
+
dampingFactor: number;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Orbit Controls. Basic functionality to orbit around a given target point in the scene.
|
|
94
|
+
*
|
|
95
|
+
* @module
|
|
96
|
+
*/
|
|
97
|
+
declare class DIVEOrbitControls extends OrbitControls {
|
|
98
|
+
static readonly DEFAULT_ZOOM_FACTOR = 1;
|
|
99
|
+
private last;
|
|
100
|
+
private animating;
|
|
101
|
+
private locked;
|
|
102
|
+
private stopMoveTo;
|
|
103
|
+
private stopRevertLast;
|
|
104
|
+
object: DIVEPerspectiveCamera;
|
|
105
|
+
domElement: HTMLCanvasElement;
|
|
106
|
+
constructor(camera: DIVEPerspectiveCamera, renderer: DIVERenderer, settings?: DIVEOrbitControlsSettings);
|
|
107
|
+
ZoomIn(by?: number): void;
|
|
108
|
+
ZoomOut(by?: number): void;
|
|
109
|
+
MoveTo(pos: Vector3Like | undefined, target: Vector3Like | undefined, duration: number, lock: boolean): void;
|
|
110
|
+
RevertLast(duration: number): void;
|
|
111
|
+
private preRenderCallback;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
type COMBaseEntity = {
|
|
115
|
+
id: string;
|
|
116
|
+
name: string;
|
|
117
|
+
entityType: 'pov' | 'light' | 'model';
|
|
118
|
+
visible: boolean;
|
|
119
|
+
};
|
|
120
|
+
type COMPov = COMBaseEntity & {
|
|
121
|
+
position: Vector3Like;
|
|
122
|
+
target: Vector3Like;
|
|
123
|
+
locked?: boolean;
|
|
124
|
+
};
|
|
125
|
+
type COMLight = COMBaseEntity & {
|
|
126
|
+
type: 'ambient' | 'point' | 'scene';
|
|
127
|
+
intensity: number;
|
|
128
|
+
color: string | number;
|
|
129
|
+
enabled: boolean;
|
|
130
|
+
position?: Vector3Like;
|
|
131
|
+
};
|
|
132
|
+
type COMModel = COMBaseEntity & {
|
|
133
|
+
uri: string;
|
|
134
|
+
position: Vector3Like;
|
|
135
|
+
rotation: Vector3Like;
|
|
136
|
+
scale: Vector3Like;
|
|
137
|
+
loaded: boolean;
|
|
138
|
+
};
|
|
139
|
+
type COMEntity = COMPov | COMLight | COMModel;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* A basic floor geometry.
|
|
143
|
+
*
|
|
144
|
+
* Can change the color and visibility of the floor.
|
|
145
|
+
*
|
|
146
|
+
* @module
|
|
147
|
+
*/
|
|
148
|
+
declare class DIVEFloor extends Mesh {
|
|
149
|
+
isFloor: true;
|
|
150
|
+
constructor();
|
|
151
|
+
SetVisibility(visible: boolean): void;
|
|
152
|
+
SetColor(color: ColorRepresentation): void;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* A basic grid for the scene.
|
|
157
|
+
*
|
|
158
|
+
* @module
|
|
159
|
+
*/
|
|
160
|
+
declare class DIVEGrid extends Object3D {
|
|
161
|
+
constructor();
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* A basic scene node to hold grid, floor and all lower level roots.
|
|
166
|
+
*
|
|
167
|
+
* @module
|
|
168
|
+
*/
|
|
169
|
+
declare class DIVERoot extends Object3D {
|
|
170
|
+
private lightRoot;
|
|
171
|
+
private modelRoot;
|
|
172
|
+
private floor;
|
|
173
|
+
private grid;
|
|
174
|
+
get Floor(): DIVEFloor;
|
|
175
|
+
get Grid(): DIVEGrid;
|
|
176
|
+
constructor();
|
|
177
|
+
GetSceneObject(object: Partial<COMEntity>): Object3D | undefined;
|
|
178
|
+
AddSceneObject(object: COMEntity): void;
|
|
179
|
+
UpdateSceneObject(object: Partial<COMEntity>): void;
|
|
180
|
+
DeleteSceneObject(object: Partial<COMEntity>): void;
|
|
181
|
+
PlaceOnFloor(object: Partial<COMModel>): void;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* A basic scene class.
|
|
186
|
+
*
|
|
187
|
+
* Comes with a root object that contains all the scene objects.
|
|
188
|
+
*
|
|
189
|
+
* @module
|
|
190
|
+
*/
|
|
191
|
+
declare class DIVEScene extends Scene {
|
|
192
|
+
private root;
|
|
193
|
+
get Root(): DIVERoot;
|
|
194
|
+
constructor();
|
|
195
|
+
SetBackground(color: ColorRepresentation): void;
|
|
196
|
+
GetSceneObject(object: Partial<COMEntity>): Object3D | undefined;
|
|
197
|
+
AddSceneObject(object: COMEntity): void;
|
|
198
|
+
UpdateSceneObject(object: Partial<COMEntity>): void;
|
|
199
|
+
DeleteSceneObject(object: Partial<COMEntity>): void;
|
|
200
|
+
PlaceOnFloor(object: Partial<COMModel>): void;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
interface SET_BACKGROUND {
|
|
204
|
+
'PAYLOAD': {
|
|
205
|
+
color: string | number;
|
|
206
|
+
};
|
|
207
|
+
'RETURN': boolean;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
interface RESET_CAMERA {
|
|
211
|
+
'PAYLOAD': {
|
|
212
|
+
duration: number;
|
|
213
|
+
};
|
|
214
|
+
'RETURN': boolean;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
interface SET_CAMERA_LAYER {
|
|
218
|
+
'PAYLOAD': {
|
|
219
|
+
layer: 'LIVE' | 'EDITOR';
|
|
220
|
+
};
|
|
221
|
+
'RETURN': boolean;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
interface ZOOM_CAMERA {
|
|
225
|
+
'PAYLOAD': {
|
|
226
|
+
direction: 'IN' | 'OUT';
|
|
227
|
+
by: number;
|
|
228
|
+
};
|
|
229
|
+
'RETURN': boolean;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
interface SET_GIZMO_MODE {
|
|
233
|
+
'PAYLOAD': {
|
|
234
|
+
mode: 'translate' | 'rotate' | 'scale';
|
|
235
|
+
};
|
|
236
|
+
'RETURN': boolean;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
interface SET_CAMERA_TRANSFORM {
|
|
240
|
+
'PAYLOAD': {
|
|
241
|
+
position: Vector3Like;
|
|
242
|
+
target: Vector3Like;
|
|
243
|
+
};
|
|
244
|
+
'RETURN': boolean;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
interface MOVE_CAMERA {
|
|
248
|
+
'PAYLOAD': {
|
|
249
|
+
position: Vector3Like;
|
|
250
|
+
target: Vector3Like;
|
|
251
|
+
locked: boolean;
|
|
252
|
+
duration: number;
|
|
253
|
+
} | {
|
|
254
|
+
id: string;
|
|
255
|
+
locked: boolean;
|
|
256
|
+
duration: number;
|
|
257
|
+
};
|
|
258
|
+
'RETURN': boolean;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
interface PLACE_ON_FLOOR {
|
|
262
|
+
'PAYLOAD': {
|
|
263
|
+
id: string;
|
|
264
|
+
};
|
|
265
|
+
'RETURN': boolean;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
interface GET_ALL_OBJECTS {
|
|
269
|
+
'PAYLOAD': Map<string, COMEntity>;
|
|
270
|
+
'RETURN': Map<string, COMEntity>;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
interface GET_OBJECTS {
|
|
274
|
+
'PAYLOAD': {
|
|
275
|
+
map: Map<string, COMEntity>;
|
|
276
|
+
ids?: string[];
|
|
277
|
+
};
|
|
278
|
+
'RETURN': Map<string, COMEntity>;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
interface ADD_OBJECT {
|
|
282
|
+
'PAYLOAD': COMEntity;
|
|
283
|
+
'RETURN': boolean;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
interface DELETE_OBJECT {
|
|
287
|
+
'PAYLOAD': Partial<COMEntity> & {
|
|
288
|
+
id: string;
|
|
289
|
+
};
|
|
290
|
+
'RETURN': boolean;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
interface UPDATE_OBJECT {
|
|
294
|
+
'PAYLOAD': Partial<COMEntity> & {
|
|
295
|
+
id: string;
|
|
296
|
+
};
|
|
297
|
+
'RETURN': boolean;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
interface MODEL_LOADED {
|
|
301
|
+
'PAYLOAD': {
|
|
302
|
+
id: string;
|
|
303
|
+
};
|
|
304
|
+
'RETURN': boolean;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
interface UPDATE_SCENE {
|
|
308
|
+
'PAYLOAD': {
|
|
309
|
+
name?: string;
|
|
310
|
+
backgroundColor?: string | number;
|
|
311
|
+
floorEnabled?: boolean;
|
|
312
|
+
floorColor?: string | number;
|
|
313
|
+
};
|
|
314
|
+
'RETURN': boolean;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
interface GENERATE_MEDIA {
|
|
318
|
+
'PAYLOAD': ({
|
|
319
|
+
position: Vector3Like;
|
|
320
|
+
target: Vector3Like;
|
|
321
|
+
} | {
|
|
322
|
+
id: string;
|
|
323
|
+
}) & {
|
|
324
|
+
width: number;
|
|
325
|
+
height: number;
|
|
326
|
+
dataUri: string;
|
|
327
|
+
};
|
|
328
|
+
'RETURN': boolean;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
type SceneData = {
|
|
332
|
+
name: string;
|
|
333
|
+
mediaItem: null;
|
|
334
|
+
backgroundColor: string;
|
|
335
|
+
floorEnabled: boolean;
|
|
336
|
+
floorColor: string;
|
|
337
|
+
userCamera: {
|
|
338
|
+
position: Vector3Like;
|
|
339
|
+
target: Vector3Like;
|
|
340
|
+
};
|
|
341
|
+
spotmarks: object[];
|
|
342
|
+
lights: COMLight[];
|
|
343
|
+
objects: COMModel[];
|
|
344
|
+
cameras: COMPov[];
|
|
345
|
+
};
|
|
346
|
+
interface GET_ALL_SCENE_DATA {
|
|
347
|
+
'PAYLOAD': object;
|
|
348
|
+
'RETURN': SceneData;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
interface SELECT_OBJECT {
|
|
352
|
+
'PAYLOAD': Partial<COMEntity> & {
|
|
353
|
+
id: string;
|
|
354
|
+
};
|
|
355
|
+
'RETURN': boolean;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
interface GET_CAMERA_TRANSFORM {
|
|
359
|
+
'PAYLOAD': object;
|
|
360
|
+
'RETURN': {
|
|
361
|
+
position: Vector3Like;
|
|
362
|
+
target: Vector3Like;
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
type Actions = {
|
|
367
|
+
GET_ALL_SCENE_DATA: GET_ALL_SCENE_DATA;
|
|
368
|
+
GET_ALL_OBJECTS: GET_ALL_OBJECTS;
|
|
369
|
+
GET_OBJECTS: GET_OBJECTS;
|
|
370
|
+
ADD_OBJECT: ADD_OBJECT;
|
|
371
|
+
UPDATE_OBJECT: UPDATE_OBJECT;
|
|
372
|
+
DELETE_OBJECT: DELETE_OBJECT;
|
|
373
|
+
SELECT_OBJECT: SELECT_OBJECT;
|
|
374
|
+
SET_BACKGROUND: SET_BACKGROUND;
|
|
375
|
+
PLACE_ON_FLOOR: PLACE_ON_FLOOR;
|
|
376
|
+
SET_CAMERA_TRANSFORM: SET_CAMERA_TRANSFORM;
|
|
377
|
+
GET_CAMERA_TRANSFORM: GET_CAMERA_TRANSFORM;
|
|
378
|
+
MOVE_CAMERA: MOVE_CAMERA;
|
|
379
|
+
RESET_CAMERA: RESET_CAMERA;
|
|
380
|
+
SET_CAMERA_LAYER: SET_CAMERA_LAYER;
|
|
381
|
+
ZOOM_CAMERA: ZOOM_CAMERA;
|
|
382
|
+
SET_GIZMO_MODE: SET_GIZMO_MODE;
|
|
383
|
+
MODEL_LOADED: MODEL_LOADED;
|
|
384
|
+
UPDATE_SCENE: UPDATE_SCENE;
|
|
385
|
+
GENERATE_MEDIA: GENERATE_MEDIA;
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
declare abstract class DIVEBaseTool {
|
|
389
|
+
protected name: string;
|
|
390
|
+
protected constructor();
|
|
391
|
+
Activate(): void;
|
|
392
|
+
Deactivate(): void;
|
|
393
|
+
onPointerDown(e: PointerEvent): void;
|
|
394
|
+
onPointerUp(e: PointerEvent): void;
|
|
395
|
+
onWheel(e: WheelEvent): void;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* A Toolbox to activate and deactivate tools to use with the pointer.
|
|
400
|
+
*
|
|
401
|
+
* @module
|
|
402
|
+
*/
|
|
403
|
+
declare class DIVEToolbox {
|
|
404
|
+
static readonly DefaultTool = "select";
|
|
405
|
+
private activeTool;
|
|
406
|
+
private selectTool;
|
|
407
|
+
private removeListenersCallback;
|
|
408
|
+
constructor(scene: DIVEScene, controller: DIVEOrbitControls);
|
|
409
|
+
dispose(): void;
|
|
410
|
+
GetActiveTool(): DIVEBaseTool;
|
|
411
|
+
UseTool(tool: string): void;
|
|
412
|
+
SetGizmoMode(mode: 'translate' | 'rotate' | 'scale'): void;
|
|
413
|
+
onPointerDown(e: PointerEvent): void;
|
|
414
|
+
onPointerUp(e: PointerEvent): void;
|
|
415
|
+
onWheel(e: WheelEvent): void;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Creates renderings of the current scene
|
|
420
|
+
*
|
|
421
|
+
* @module
|
|
422
|
+
*/
|
|
423
|
+
declare class DIVEMediaCreator {
|
|
424
|
+
private renderer;
|
|
425
|
+
private scene;
|
|
426
|
+
private controller;
|
|
427
|
+
constructor(renderer: DIVERenderer, scene: DIVEScene, controller: DIVEOrbitControls);
|
|
428
|
+
GenerateMedia(position: Vector3Like, target: Vector3Like, width: number, height: number): string;
|
|
429
|
+
DrawCanvas(canvasElement?: HTMLCanvasElement): HTMLCanvasElement;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
type EventListener<Action extends keyof Actions> = (payload: Actions[Action]['PAYLOAD']) => void;
|
|
433
|
+
type Unsubscribe = () => boolean;
|
|
434
|
+
/**
|
|
435
|
+
* Main class for communicating with DIVE.
|
|
436
|
+
*
|
|
437
|
+
* You can subscribe to actions and perform them from outside and inside DIVE.
|
|
438
|
+
*
|
|
439
|
+
* ```ts
|
|
440
|
+
* import { DIVE } from "@shopware-ag/dive";
|
|
441
|
+
*
|
|
442
|
+
* const dive = new DIVE();
|
|
443
|
+
*
|
|
444
|
+
* dive.Communication.Subscribe('GET_ALL_SCENE_DATA', () => {
|
|
445
|
+
* // do something
|
|
446
|
+
* }));
|
|
447
|
+
*
|
|
448
|
+
* dive.Communication.PerformAction('GET_ALL_SCENE_DATA', {});
|
|
449
|
+
* ```
|
|
450
|
+
*
|
|
451
|
+
* @module
|
|
452
|
+
*/
|
|
453
|
+
declare class DIVECommunication {
|
|
454
|
+
private static __instances;
|
|
455
|
+
static get(id: string): DIVECommunication | undefined;
|
|
456
|
+
private id;
|
|
457
|
+
private scene;
|
|
458
|
+
private controller;
|
|
459
|
+
private toolbox;
|
|
460
|
+
private mediaGenerator;
|
|
461
|
+
private registered;
|
|
462
|
+
private listeners;
|
|
463
|
+
constructor(scene: DIVEScene, controls: DIVEOrbitControls, toolbox: DIVEToolbox, mediaGenerator: DIVEMediaCreator);
|
|
464
|
+
DestroyInstance(): boolean;
|
|
465
|
+
PerformAction<Action extends keyof Actions>(action: Action, payload: Actions[Action]['PAYLOAD']): Actions[Action]['RETURN'];
|
|
466
|
+
Subscribe<Action extends keyof Actions>(type: Action, listener: EventListener<Action>): Unsubscribe;
|
|
467
|
+
private dispatch;
|
|
468
|
+
private getAllSceneData;
|
|
469
|
+
private getAllObjects;
|
|
470
|
+
private getObjects;
|
|
471
|
+
private addObject;
|
|
472
|
+
private updateObject;
|
|
473
|
+
private deleteObject;
|
|
474
|
+
private selectObject;
|
|
475
|
+
private setBackground;
|
|
476
|
+
private placeOnFloor;
|
|
477
|
+
private setCameraTransform;
|
|
478
|
+
private getCameraTransform;
|
|
479
|
+
private moveCamera;
|
|
480
|
+
private setCameraLayer;
|
|
481
|
+
private resetCamera;
|
|
482
|
+
private zoomCamera;
|
|
483
|
+
private setGizmoMode;
|
|
484
|
+
private modelLoaded;
|
|
485
|
+
private updateScene;
|
|
486
|
+
private generateMedia;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
declare function ceilExp(number: number, decimals?: number): number;
|
|
490
|
+
|
|
491
|
+
declare function floorExp(number: number, decimals?: number): number;
|
|
492
|
+
|
|
493
|
+
declare function roundExponential(number: number, decimals?: number): number;
|
|
494
|
+
|
|
495
|
+
declare function toFixedExp(number: number, decimals?: number): string;
|
|
496
|
+
|
|
497
|
+
declare function truncateExp(number: number, decimals?: number): number;
|
|
498
|
+
|
|
499
|
+
declare const DIVEMath: {
|
|
500
|
+
ceilExp: typeof ceilExp;
|
|
501
|
+
floorExp: typeof floorExp;
|
|
502
|
+
roundExp: typeof roundExponential;
|
|
503
|
+
toFixedExp: typeof toFixedExp;
|
|
504
|
+
truncateExp: typeof truncateExp;
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
type DIVESettings = {
|
|
508
|
+
autoResize: boolean;
|
|
509
|
+
renderer: DIVERendererSettings;
|
|
510
|
+
perspectiveCamera: DIVEPerspectiveCameraSettings;
|
|
511
|
+
orbitControls: DIVEOrbitControlsSettings;
|
|
512
|
+
};
|
|
513
|
+
declare const DIVEDefaultSettings: DIVESettings;
|
|
514
|
+
/**
|
|
515
|
+
* #### DIVE
|
|
516
|
+
* is the main class of the DIVE framework.
|
|
517
|
+
*
|
|
518
|
+
* An instance of this class delivers a complete 3D environment with a perspective camera, orbit controls, a toolbox, and a communication system.
|
|
519
|
+
* ```ts
|
|
520
|
+
* import { DIVE } from "@shopware-ag/dive";
|
|
521
|
+
*
|
|
522
|
+
* const myWrapper = document.getElementById('myWrapper');
|
|
523
|
+
*
|
|
524
|
+
* const dive = new DIVE();
|
|
525
|
+
*
|
|
526
|
+
* myWrapper.appendChild(dive.Canvas);
|
|
527
|
+
*
|
|
528
|
+
* dive.Communication.Subscribe('GET_ALL_SCENE_DATA', () => {
|
|
529
|
+
* // do something
|
|
530
|
+
* }));
|
|
531
|
+
*
|
|
532
|
+
* dive.Communication.PerformAction('GET_ALL_SCENE_DATA', {});
|
|
533
|
+
* ```
|
|
534
|
+
* @module
|
|
535
|
+
*/
|
|
536
|
+
declare class DIVE {
|
|
537
|
+
private _settings;
|
|
538
|
+
private _resizeObserverId;
|
|
539
|
+
private _width;
|
|
540
|
+
private _height;
|
|
541
|
+
private renderer;
|
|
542
|
+
private scene;
|
|
543
|
+
private perspectiveCamera;
|
|
544
|
+
private orbitControls;
|
|
545
|
+
private mediaCreator;
|
|
546
|
+
private toolbox;
|
|
547
|
+
private communication;
|
|
548
|
+
private animationSystem;
|
|
549
|
+
private axisCamera;
|
|
550
|
+
get Communication(): DIVECommunication;
|
|
551
|
+
get Canvas(): HTMLCanvasElement;
|
|
552
|
+
set Settings(settings: Partial<DIVESettings>);
|
|
553
|
+
constructor(settings?: Partial<DIVESettings>);
|
|
554
|
+
OnResize(width: number, height: number): void;
|
|
555
|
+
private addResizeObserver;
|
|
556
|
+
private removeResizeObserver;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
export { type Actions, type COMEntity, type COMLight, type COMModel, type COMPov, DIVE, DIVECommunication, DIVEDefaultSettings, DIVEMath, type DIVESettings, DIVE as default };
|