@combeenation/3d-viewer 13.0.1 → 14.0.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/lib-cjs/buildinfo.json +1 -1
- package/dist/lib-cjs/commonjs.tsconfig.tsbuildinfo +1 -1
- package/dist/lib-cjs/index.d.ts +0 -1
- package/dist/lib-cjs/index.js +0 -1
- package/dist/lib-cjs/index.js.map +1 -1
- package/dist/lib-cjs/manager/camera-manager.d.ts +60 -1
- package/dist/lib-cjs/manager/camera-manager.js +62 -9
- package/dist/lib-cjs/manager/camera-manager.js.map +1 -1
- package/dist/lib-cjs/viewer.d.ts +1 -3
- package/dist/lib-cjs/viewer.js +0 -4
- package/dist/lib-cjs/viewer.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +0 -1
- package/src/manager/camera-manager.ts +140 -11
- package/src/viewer.ts +0 -6
- package/dist/lib-cjs/manager/screenshot-manager.d.ts +0 -36
- package/dist/lib-cjs/manager/screenshot-manager.js +0 -40
- package/dist/lib-cjs/manager/screenshot-manager.js.map +0 -1
- package/src/manager/screenshot-manager.ts +0 -59
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"screenshot-manager.js","sourceRoot":"","sources":["../../../src/manager/screenshot-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oCAAoE;AA2BpE;;GAEG;AACH,MAAa,iBAAiB;IAC5B,gBAAgB;IAChB,YAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAE/C;;;OAGG;IACU,cAAc,CAAC,QAA6B;;;YACvD,oGAAoG;YACpG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YAE3B,MAAM,IAAI,GAAG,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,mCAAI,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;YAElH,MAAM,QAAQ,GAAG,MAAM,uBAAe,CAAC,sCAAsC,CAC3E,IAAI,CAAC,MAAM,CAAC,MAAM;YAClB,kFAAkF;YAClF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,YAAa,EAC/B,IAAI,EACJ,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,QAAQ,EAClB,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,EACjB,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,YAAY,EACtB,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,QAAQ,EAClB,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,aAAa,CACxB,CAAC;YAEF,OAAO,QAAQ,CAAC;;KACjB;CACF;AA5BD,8CA4BC"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { IScreenshotSize, ScreenshotTools, Viewer } from '../index';
|
|
2
|
-
|
|
3
|
-
// NOTE: this module will be reworked in the near future (CB-8789)
|
|
4
|
-
|
|
5
|
-
export type ScreenshotSettings = {
|
|
6
|
-
/** Defaults to canvas width & height */
|
|
7
|
-
size?: IScreenshotSize;
|
|
8
|
-
/**
|
|
9
|
-
* Default `image/png`
|
|
10
|
-
*
|
|
11
|
-
* **Info regarding JPEG:** \
|
|
12
|
-
* Use mimeType `image/jpeg` (**not** `image/jpg`) when creating jpeg's. \
|
|
13
|
-
* Also ensure that the viewer scenes `clearColor` has an alpha value of `1` as jpeg's don't
|
|
14
|
-
* support transparency. Otherwise background will always be black for jpeg's.
|
|
15
|
-
*/
|
|
16
|
-
mimeType?: string;
|
|
17
|
-
/** Default `1` */
|
|
18
|
-
samples?: number;
|
|
19
|
-
/** Default `false` */
|
|
20
|
-
antialiasing?: boolean;
|
|
21
|
-
/** NOTE: after update to Babylon.js V6: if file name is given, the screenshot image will be downloaded and the base64
|
|
22
|
-
* string will NOT be returned! */
|
|
23
|
-
fileName?: string;
|
|
24
|
-
/** Default `false` */
|
|
25
|
-
renderSprites?: boolean;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Manager for tasks related to screenshots
|
|
30
|
-
*/
|
|
31
|
-
export class ScreenshotManager {
|
|
32
|
-
/** @internal */
|
|
33
|
-
public constructor(protected viewer: Viewer) {}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Takes a sceenshot the the current scene.\
|
|
37
|
-
* The result is a string containing a base64 encoded image.
|
|
38
|
-
*/
|
|
39
|
-
public async takeScreenshot(settings?: ScreenshotSettings): Promise<string> {
|
|
40
|
-
// in combination with a render target, we need to refresh the scene manually to get the latest view
|
|
41
|
-
this.viewer.scene.render();
|
|
42
|
-
|
|
43
|
-
const size = settings?.size ?? { width: this.viewer.canvas.clientWidth, height: this.viewer.canvas.clientHeight };
|
|
44
|
-
|
|
45
|
-
const imageStr = await ScreenshotTools.CreateScreenshotUsingRenderTargetAsync(
|
|
46
|
-
this.viewer.engine,
|
|
47
|
-
// mark as non-nullable as we wouldn't come this far if no camera is active anyway
|
|
48
|
-
this.viewer.scene.activeCamera!,
|
|
49
|
-
size,
|
|
50
|
-
settings?.mimeType,
|
|
51
|
-
settings?.samples,
|
|
52
|
-
settings?.antialiasing,
|
|
53
|
-
settings?.fileName,
|
|
54
|
-
settings?.renderSprites
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
return imageStr;
|
|
58
|
-
}
|
|
59
|
-
}
|