@shapediver/viewer.viewport 3.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/LICENSE +73 -0
- package/README.md +1 -0
- package/dist/implementation/PostProcessingApi.d.ts +49 -0
- package/dist/implementation/PostProcessingApi.d.ts.map +1 -0
- package/dist/implementation/PostProcessingApi.js +142 -0
- package/dist/implementation/PostProcessingApi.js.map +1 -0
- package/dist/implementation/ViewportApi.d.ts +200 -0
- package/dist/implementation/ViewportApi.d.ts.map +1 -0
- package/dist/implementation/ViewportApi.js +879 -0
- package/dist/implementation/ViewportApi.js.map +1 -0
- package/dist/implementation/camera/AbstractCameraApi.d.ts +138 -0
- package/dist/implementation/camera/AbstractCameraApi.d.ts.map +1 -0
- package/dist/implementation/camera/AbstractCameraApi.js +473 -0
- package/dist/implementation/camera/AbstractCameraApi.js.map +1 -0
- package/dist/implementation/camera/OrthographicCameraApi.d.ts +11 -0
- package/dist/implementation/camera/OrthographicCameraApi.d.ts.map +1 -0
- package/dist/implementation/camera/OrthographicCameraApi.js +48 -0
- package/dist/implementation/camera/OrthographicCameraApi.js.map +1 -0
- package/dist/implementation/camera/PerspectiveCameraApi.d.ts +11 -0
- package/dist/implementation/camera/PerspectiveCameraApi.d.ts.map +1 -0
- package/dist/implementation/camera/PerspectiveCameraApi.js +47 -0
- package/dist/implementation/camera/PerspectiveCameraApi.js.map +1 -0
- package/dist/implementation/lights/AbstractLightApi.d.ts +20 -0
- package/dist/implementation/lights/AbstractLightApi.d.ts.map +1 -0
- package/dist/implementation/lights/AbstractLightApi.js +81 -0
- package/dist/implementation/lights/AbstractLightApi.js.map +1 -0
- package/dist/implementation/lights/LightSceneApi.d.ts +69 -0
- package/dist/implementation/lights/LightSceneApi.d.ts.map +1 -0
- package/dist/implementation/lights/LightSceneApi.js +172 -0
- package/dist/implementation/lights/LightSceneApi.js.map +1 -0
- package/dist/implementation/lights/types/AmbientLightApi.d.ts +9 -0
- package/dist/implementation/lights/types/AmbientLightApi.d.ts.map +1 -0
- package/dist/implementation/lights/types/AmbientLightApi.js +27 -0
- package/dist/implementation/lights/types/AmbientLightApi.js.map +1 -0
- package/dist/implementation/lights/types/DirectionalLightApi.d.ts +18 -0
- package/dist/implementation/lights/types/DirectionalLightApi.d.ts.map +1 -0
- package/dist/implementation/lights/types/DirectionalLightApi.js +77 -0
- package/dist/implementation/lights/types/DirectionalLightApi.js.map +1 -0
- package/dist/implementation/lights/types/HemisphereLightApi.d.ts +12 -0
- package/dist/implementation/lights/types/HemisphereLightApi.d.ts.map +1 -0
- package/dist/implementation/lights/types/HemisphereLightApi.js +47 -0
- package/dist/implementation/lights/types/HemisphereLightApi.js.map +1 -0
- package/dist/implementation/lights/types/PointLightApi.d.ts +16 -0
- package/dist/implementation/lights/types/PointLightApi.d.ts.map +1 -0
- package/dist/implementation/lights/types/PointLightApi.js +67 -0
- package/dist/implementation/lights/types/PointLightApi.js.map +1 -0
- package/dist/implementation/lights/types/SpotLightApi.d.ts +22 -0
- package/dist/implementation/lights/types/SpotLightApi.d.ts.map +1 -0
- package/dist/implementation/lights/types/SpotLightApi.js +97 -0
- package/dist/implementation/lights/types/SpotLightApi.js.map +1 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +160 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/IPostProcessingApi.d.ts +229 -0
- package/dist/interfaces/IPostProcessingApi.d.ts.map +1 -0
- package/dist/interfaces/IPostProcessingApi.js +3 -0
- package/dist/interfaces/IPostProcessingApi.js.map +1 -0
- package/dist/interfaces/IViewportApi.d.ts +632 -0
- package/dist/interfaces/IViewportApi.d.ts.map +1 -0
- package/dist/interfaces/IViewportApi.js +3 -0
- package/dist/interfaces/IViewportApi.js.map +1 -0
- package/dist/interfaces/camera/ICameraApi.d.ts +249 -0
- package/dist/interfaces/camera/ICameraApi.d.ts.map +1 -0
- package/dist/interfaces/camera/ICameraApi.js +3 -0
- package/dist/interfaces/camera/ICameraApi.js.map +1 -0
- package/dist/interfaces/camera/IOrthographicCameraApi.d.ts +14 -0
- package/dist/interfaces/camera/IOrthographicCameraApi.d.ts.map +1 -0
- package/dist/interfaces/camera/IOrthographicCameraApi.js +3 -0
- package/dist/interfaces/camera/IOrthographicCameraApi.js.map +1 -0
- package/dist/interfaces/camera/IPerspectiveCameraApi.d.ts +13 -0
- package/dist/interfaces/camera/IPerspectiveCameraApi.d.ts.map +1 -0
- package/dist/interfaces/camera/IPerspectiveCameraApi.js +3 -0
- package/dist/interfaces/camera/IPerspectiveCameraApi.js.map +1 -0
- package/dist/interfaces/lights/ILightApi.d.ts +36 -0
- package/dist/interfaces/lights/ILightApi.d.ts.map +1 -0
- package/dist/interfaces/lights/ILightApi.js +3 -0
- package/dist/interfaces/lights/ILightApi.js.map +1 -0
- package/dist/interfaces/lights/ILightSceneApi.d.ts +139 -0
- package/dist/interfaces/lights/ILightSceneApi.d.ts.map +1 -0
- package/dist/interfaces/lights/ILightSceneApi.js +3 -0
- package/dist/interfaces/lights/ILightSceneApi.js.map +1 -0
- package/dist/interfaces/lights/types/IAmbientLightApi.d.ts +7 -0
- package/dist/interfaces/lights/types/IAmbientLightApi.d.ts.map +1 -0
- package/dist/interfaces/lights/types/IAmbientLightApi.js +3 -0
- package/dist/interfaces/lights/types/IAmbientLightApi.js.map +1 -0
- package/dist/interfaces/lights/types/IDirectionalLightApi.d.ts +25 -0
- package/dist/interfaces/lights/types/IDirectionalLightApi.d.ts.map +1 -0
- package/dist/interfaces/lights/types/IDirectionalLightApi.js +3 -0
- package/dist/interfaces/lights/types/IDirectionalLightApi.js.map +1 -0
- package/dist/interfaces/lights/types/IHemisphereLightApi.d.ts +13 -0
- package/dist/interfaces/lights/types/IHemisphereLightApi.d.ts.map +1 -0
- package/dist/interfaces/lights/types/IHemisphereLightApi.js +3 -0
- package/dist/interfaces/lights/types/IHemisphereLightApi.js.map +1 -0
- package/dist/interfaces/lights/types/IPointLightApi.d.ts +21 -0
- package/dist/interfaces/lights/types/IPointLightApi.d.ts.map +1 -0
- package/dist/interfaces/lights/types/IPointLightApi.js +3 -0
- package/dist/interfaces/lights/types/IPointLightApi.js.map +1 -0
- package/dist/interfaces/lights/types/ISpotLightApi.d.ts +33 -0
- package/dist/interfaces/lights/types/ISpotLightApi.d.ts.map +1 -0
- package/dist/interfaces/lights/types/ISpotLightApi.js +3 -0
- package/dist/interfaces/lights/types/ISpotLightApi.js.map +1 -0
- package/dist/main.d.ts +29 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +80 -0
- package/dist/main.js.map +1 -0
- package/package.json +78 -0
- package/src/implementation/PostProcessingApi.ts +184 -0
- package/src/implementation/ViewportApi.ts +1060 -0
- package/src/implementation/camera/AbstractCameraApi.ts +556 -0
- package/src/implementation/camera/OrthographicCameraApi.ts +43 -0
- package/src/implementation/camera/PerspectiveCameraApi.ts +43 -0
- package/src/implementation/lights/AbstractLightApi.ts +87 -0
- package/src/implementation/lights/LightSceneApi.ts +198 -0
- package/src/implementation/lights/types/AmbientLightApi.ts +24 -0
- package/src/implementation/lights/types/DirectionalLightApi.ts +80 -0
- package/src/implementation/lights/types/HemisphereLightApi.ts +44 -0
- package/src/implementation/lights/types/PointLightApi.ts +68 -0
- package/src/implementation/lights/types/SpotLightApi.ts +104 -0
- package/src/index.ts +297 -0
- package/src/interfaces/IPostProcessingApi.ts +269 -0
- package/src/interfaces/IViewportApi.ts +629 -0
- package/src/interfaces/camera/ICameraApi.ts +233 -0
- package/src/interfaces/camera/IOrthographicCameraApi.ts +18 -0
- package/src/interfaces/camera/IPerspectiveCameraApi.ts +17 -0
- package/src/interfaces/lights/ILightApi.ts +41 -0
- package/src/interfaces/lights/ILightSceneApi.ts +147 -0
- package/src/interfaces/lights/types/IAmbientLightApi.ts +7 -0
- package/src/interfaces/lights/types/IDirectionalLightApi.ts +29 -0
- package/src/interfaces/lights/types/IHemisphereLightApi.ts +17 -0
- package/src/interfaces/lights/types/IPointLightApi.ts +25 -0
- package/src/interfaces/lights/types/ISpotLightApi.ts +37 -0
- package/src/main.ts +85 -0
- package/tsconfig.json +17 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ILightApi } from '../ILightApi';
|
|
2
|
+
import { vec3 } from 'gl-matrix';
|
|
3
|
+
/**
|
|
4
|
+
* The api for a spot light.
|
|
5
|
+
* A spot light can be created by calling the {@link addSpotLight} method.
|
|
6
|
+
*/
|
|
7
|
+
export interface ISpotLightApi extends ILightApi {
|
|
8
|
+
/**
|
|
9
|
+
* The angle of the light.
|
|
10
|
+
*/
|
|
11
|
+
angle: number;
|
|
12
|
+
/**
|
|
13
|
+
* The decay of the light.
|
|
14
|
+
*/
|
|
15
|
+
decay: number;
|
|
16
|
+
/**
|
|
17
|
+
* The distance of the light.
|
|
18
|
+
*/
|
|
19
|
+
distance: number;
|
|
20
|
+
/**
|
|
21
|
+
* The penumbra of the light.
|
|
22
|
+
*/
|
|
23
|
+
penumbra: number;
|
|
24
|
+
/**
|
|
25
|
+
* The position of the light.
|
|
26
|
+
*/
|
|
27
|
+
position: vec3;
|
|
28
|
+
/**
|
|
29
|
+
* The target of the light.
|
|
30
|
+
*/
|
|
31
|
+
target: vec3;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=ISpotLightApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISpotLightApi.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/lights/types/ISpotLightApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;GAGG;AACH,MAAM,WAAW,aAAc,SAAQ,SAAS;IAG5C;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,IAAI,CAAC;IACf;;OAEG;IACH,MAAM,EAAE,IAAI,CAAC;CAGhB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISpotLightApi.js","sourceRoot":"","sources":["../../../../src/interfaces/lights/types/ISpotLightApi.ts"],"names":[],"mappings":""}
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ViewportCreationDefinition } from '@shapediver/viewer.creation-control-center.viewport';
|
|
2
|
+
import { IViewportApi } from './interfaces/IViewportApi';
|
|
3
|
+
/**
|
|
4
|
+
* The viewports that are currently being used.
|
|
5
|
+
*/
|
|
6
|
+
export declare const viewports: {
|
|
7
|
+
[key: string]: IViewportApi;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Create and initialize a viewport with the provided type and canvas,
|
|
11
|
+
* and return a viewport api object allowing to control it.
|
|
12
|
+
*
|
|
13
|
+
* An optional identifier for the viewport can be provided. This identifier can be used to retrieve the
|
|
14
|
+
* viewport object from {@link viewports}. In case no identifier is provided, a unique one will be generated.
|
|
15
|
+
*
|
|
16
|
+
* By default a new viewport displays the complete scene tree. Viewports can be excluded from
|
|
17
|
+
* displaying geometry for specific sessions by using the {@link excludeViewports} property of
|
|
18
|
+
* {@link ISessionApi}.
|
|
19
|
+
*
|
|
20
|
+
* @param properties.visibility The visibility of the viewport.
|
|
21
|
+
* @param properties.canvas The canvas that the viewport should use. A canvas element will be created if none is provided.
|
|
22
|
+
* @param properties.id The unique identifier to use for the viewport.
|
|
23
|
+
* @param properties.branding Optional branding options.
|
|
24
|
+
* @param properties.sessionSettingsId Optional identifier of the session to be used for loading / persisting settings of the viewport when the {@link SESSION_SETTINGS_MODE} is set to MANUAL.
|
|
25
|
+
* @param properties.sessionSettingsMode Allows to control which session to use for loading / persisting settings of the viewport. (default: {@link SESSION_SETTINGS_MODE.FIRST}).
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
export declare const createViewport: (properties?: ViewportCreationDefinition) => Promise<IViewportApi>;
|
|
29
|
+
//# sourceMappingURL=main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAKA,OAAO,EAAiE,0BAA0B,EAAE,MAAM,qDAAqD,CAAC;AAEhK,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AASzD;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAC;CAAO,CAAC;AAgB9D;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,cAAc,gBAAuB,0BAA0B,KAAG,QAAQ,YAAY,CA8BlG,CAAC"}
|
package/dist/main.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.createViewport = exports.viewports = void 0;
|
|
13
|
+
const viewer_rendering_engine_rendering_engine_1 = require("@shapediver/viewer.rendering-engine.rendering-engine");
|
|
14
|
+
const viewer_creation_control_center_viewport_1 = require("@shapediver/viewer.creation-control-center.viewport");
|
|
15
|
+
const viewer_shared_services_1 = require("@shapediver/viewer.shared.services");
|
|
16
|
+
const viewer_api_general_1 = require("@shapediver/viewer.api.general");
|
|
17
|
+
const ViewportApi_1 = require("./implementation/ViewportApi");
|
|
18
|
+
const creationControlCenterViewport = viewer_creation_control_center_viewport_1.CreationControlCenterViewport.instance;
|
|
19
|
+
const inputValidator = viewer_shared_services_1.InputValidator.instance;
|
|
20
|
+
const logger = viewer_shared_services_1.Logger.instance;
|
|
21
|
+
/**
|
|
22
|
+
* The viewports that are currently being used.
|
|
23
|
+
*/
|
|
24
|
+
exports.viewports = {};
|
|
25
|
+
// Whenever a session or viewport is added or removed, this update is called.
|
|
26
|
+
creationControlCenterViewport.updateViewports = (renderingEngines) => {
|
|
27
|
+
for (const v in renderingEngines)
|
|
28
|
+
if (!exports.viewports[v])
|
|
29
|
+
exports.viewports[v] = new ViewportApi_1.ViewportApi(renderingEngines[v]);
|
|
30
|
+
for (const v in exports.viewports) {
|
|
31
|
+
if (!renderingEngines[v])
|
|
32
|
+
delete exports.viewports[v];
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Create and initialize a viewport with the provided type and canvas,
|
|
37
|
+
* and return a viewport api object allowing to control it.
|
|
38
|
+
*
|
|
39
|
+
* An optional identifier for the viewport can be provided. This identifier can be used to retrieve the
|
|
40
|
+
* viewport object from {@link viewports}. In case no identifier is provided, a unique one will be generated.
|
|
41
|
+
*
|
|
42
|
+
* By default a new viewport displays the complete scene tree. Viewports can be excluded from
|
|
43
|
+
* displaying geometry for specific sessions by using the {@link excludeViewports} property of
|
|
44
|
+
* {@link ISessionApi}.
|
|
45
|
+
*
|
|
46
|
+
* @param properties.visibility The visibility of the viewport.
|
|
47
|
+
* @param properties.canvas The canvas that the viewport should use. A canvas element will be created if none is provided.
|
|
48
|
+
* @param properties.id The unique identifier to use for the viewport.
|
|
49
|
+
* @param properties.branding Optional branding options.
|
|
50
|
+
* @param properties.sessionSettingsId Optional identifier of the session to be used for loading / persisting settings of the viewport when the {@link SESSION_SETTINGS_MODE} is set to MANUAL.
|
|
51
|
+
* @param properties.sessionSettingsMode Allows to control which session to use for loading / persisting settings of the viewport. (default: {@link SESSION_SETTINGS_MODE.FIRST}).
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
const createViewport = (properties) => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
+
(0, viewer_api_general_1.showConsoleMessage)();
|
|
56
|
+
logger.debug(`createSession: Creating and initializing session with properties ${JSON.stringify(properties)}.`);
|
|
57
|
+
inputValidator.validateAndError('createViewport', properties, 'object', false);
|
|
58
|
+
const prop = Object.assign({}, properties);
|
|
59
|
+
inputValidator.validateAndError('createViewport', prop.canvas, 'HTMLCanvasElement', false);
|
|
60
|
+
inputValidator.validateAndError('createViewport', prop.id, 'string', false);
|
|
61
|
+
inputValidator.validateAndError('createViewport', prop.sessionSettingsId, 'string', false);
|
|
62
|
+
inputValidator.validateAndError('createViewport', prop.sessionSettingsMode, 'enum', false, Object.values(viewer_shared_services_1.SESSION_SETTINGS_MODE));
|
|
63
|
+
inputValidator.validateAndError('createViewport', prop.visibility, 'enum', false, Object.values(viewer_rendering_engine_rendering_engine_1.VISIBILITY_MODE));
|
|
64
|
+
inputValidator.validateAndError('createViewport', prop.branding, 'object', false);
|
|
65
|
+
const branding = Object.assign({}, prop.branding);
|
|
66
|
+
if (branding.logo !== null)
|
|
67
|
+
inputValidator.validateAndError('createViewport', branding.logo, 'string', false);
|
|
68
|
+
inputValidator.validateAndError('createViewport', branding.backgroundColor, 'string', false);
|
|
69
|
+
inputValidator.validateAndError('createViewport', branding.busyModeSpinner, 'string', false);
|
|
70
|
+
inputValidator.validateAndError('createViewport', branding.busyModeDisplay, 'enum', false, Object.values(viewer_rendering_engine_rendering_engine_1.BUSY_MODE_DISPLAY));
|
|
71
|
+
inputValidator.validateAndError('createViewport', branding.spinnerPositioning, 'enum', false, Object.values(viewer_rendering_engine_rendering_engine_1.SPINNER_POSITIONING));
|
|
72
|
+
prop.sessionSettingsMode = prop.sessionSettingsMode !== undefined ? prop.sessionSettingsMode : viewer_shared_services_1.SESSION_SETTINGS_MODE.FIRST;
|
|
73
|
+
if (prop.sessionSettingsMode === viewer_shared_services_1.SESSION_SETTINGS_MODE.MANUAL && !prop.sessionSettingsId)
|
|
74
|
+
throw new viewer_shared_services_1.ShapeDiverViewerValidationError('createViewport: Input could not be validated. sessionSettingsId has to point to a valid and created session when using SESSION_SETTINGS_MODE.MANUAL', prop.sessionSettingsId, 'string');
|
|
75
|
+
const renderingEngine = yield creationControlCenterViewport.createViewportEngine(prop);
|
|
76
|
+
exports.viewports[renderingEngine.id] = new ViewportApi_1.ViewportApi(renderingEngine);
|
|
77
|
+
return exports.viewports[renderingEngine.id];
|
|
78
|
+
});
|
|
79
|
+
exports.createViewport = createViewport;
|
|
80
|
+
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mHAI8D;AAC9D,iHAAgK;AAChK,+EAAoI;AAGpI,uEAAoE;AACpE,8DAA2D;AAE3D,MAAM,6BAA6B,GAAmC,uEAA6B,CAAC,QAAQ,CAAC;AAC7G,MAAM,cAAc,GAAmB,uCAAc,CAAC,QAAQ,CAAC;AAC/D,MAAM,MAAM,GAAW,+BAAM,CAAC,QAAQ,CAAC;AAEvC;;GAEG;AACU,QAAA,SAAS,GAAqC,EAAE,CAAC;AAE9D,6EAA6E;AAC7E,6BAA6B,CAAC,eAAe,GAAG,CAC5C,gBAA4D,EAC9D,EAAE;IACA,KAAK,MAAM,CAAC,IAAI,gBAAgB;QAC5B,IAAI,CAAC,iBAAS,CAAC,CAAC,CAAC;YACb,iBAAS,CAAC,CAAC,CAAC,GAAG,IAAI,yBAAW,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;IAE5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CAAC,eAAe,CAAC,CAAC;IACjE,OAAO,iBAAS,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;AACzC,CAAC,CAAA,CAAC;AA9BW,QAAA,cAAc,kBA8BzB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@shapediver/viewer.viewport",
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"webgl",
|
|
7
|
+
"shapediver",
|
|
8
|
+
"viewer",
|
|
9
|
+
"augumented-reality",
|
|
10
|
+
"webgl",
|
|
11
|
+
"grasshopper",
|
|
12
|
+
"typescript",
|
|
13
|
+
"3d"
|
|
14
|
+
],
|
|
15
|
+
"author": "Michael Oppitz <michael@shapediver.com>",
|
|
16
|
+
"license": "polyform-noncommercial-1.0.0",
|
|
17
|
+
"main": "dist/index.js",
|
|
18
|
+
"directories": {
|
|
19
|
+
"test": "__tests__"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"src",
|
|
24
|
+
"package.json",
|
|
25
|
+
"README.md",
|
|
26
|
+
"tsconfig.json"
|
|
27
|
+
],
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "git+https://github.com/shapediver/Viewer.git"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"check": "tsc --noEmit",
|
|
37
|
+
"build": "bash ../../scripts/building/build.sh",
|
|
38
|
+
"build-watch": "bash ../../scripts/building/build-watch.sh",
|
|
39
|
+
"build-dep": "bash ../../scripts/building/build-dep.sh",
|
|
40
|
+
"doc": "typedoc"
|
|
41
|
+
},
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/shapediver/Viewer/issues"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/shapediver/Viewer#readme",
|
|
46
|
+
"typings": "dist/index.d.ts",
|
|
47
|
+
"jest": {
|
|
48
|
+
"preset": "ts-jest",
|
|
49
|
+
"testEnvironment": "jsdom"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@shapediver/sdk.geometry-api-sdk-v2": "1.8.2",
|
|
53
|
+
"@shapediver/viewer.api.general": "3.0.0",
|
|
54
|
+
"@shapediver/viewer.creation-control-center.viewport": "3.0.0",
|
|
55
|
+
"@shapediver/viewer.data-engine.data-engine": "3.0.0",
|
|
56
|
+
"@shapediver/viewer.data-engine.geometry-engine": "3.0.0",
|
|
57
|
+
"@shapediver/viewer.data-engine.gltf-converter": "3.0.0",
|
|
58
|
+
"@shapediver/viewer.data-engine.material-engine": "3.0.0",
|
|
59
|
+
"@shapediver/viewer.data-engine.shared-types": "3.0.0",
|
|
60
|
+
"@shapediver/viewer.rendering-engine.animation-engine": "3.0.0",
|
|
61
|
+
"@shapediver/viewer.rendering-engine.camera-engine": "3.0.0",
|
|
62
|
+
"@shapediver/viewer.rendering-engine.light-engine": "3.0.0",
|
|
63
|
+
"@shapediver/viewer.rendering-engine.rendering-engine": "3.0.0",
|
|
64
|
+
"@shapediver/viewer.rendering-engine.rendering-engine-threejs": "3.0.0",
|
|
65
|
+
"@shapediver/viewer.settings": "1.0.1",
|
|
66
|
+
"@shapediver/viewer.shared.build-data": "3.0.0",
|
|
67
|
+
"@shapediver/viewer.shared.math": "3.0.0",
|
|
68
|
+
"@shapediver/viewer.shared.node-tree": "3.0.0",
|
|
69
|
+
"@shapediver/viewer.shared.services": "3.0.0",
|
|
70
|
+
"@shapediver/viewer.shared.types": "3.0.0",
|
|
71
|
+
"@types/qrcode": "^1.5.0",
|
|
72
|
+
"@types/three": "0.162.0",
|
|
73
|
+
"gl-matrix": "3.3.0",
|
|
74
|
+
"qrcode": "^1.5.0",
|
|
75
|
+
"three": "0.162.0"
|
|
76
|
+
},
|
|
77
|
+
"gitHead": "b6b0010bf5d5652aa338df8016405d97f33fcabb"
|
|
78
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ANTI_ALIASING_TECHNIQUE,
|
|
3
|
+
Effect,
|
|
4
|
+
EffectComposer,
|
|
5
|
+
IPostProcessingEffectDefinition,
|
|
6
|
+
IPostProcessingEffectsArray,
|
|
7
|
+
POST_PROCESSING_EFFECT_TYPE,
|
|
8
|
+
RenderingEngine as RenderingEngineThreeJs
|
|
9
|
+
} from '@shapediver/viewer.rendering-engine.rendering-engine-threejs';
|
|
10
|
+
import { InputValidator, Logger } from '@shapediver/viewer.shared.services';
|
|
11
|
+
import { IPostProcessingApi } from '../interfaces/IPostProcessingApi';
|
|
12
|
+
import { ITreeNode } from '@shapediver/viewer.shared.node-tree';
|
|
13
|
+
import { IViewportApi } from '../interfaces/IViewportApi';
|
|
14
|
+
|
|
15
|
+
export class PostProcessingApi implements IPostProcessingApi {
|
|
16
|
+
// #region Properties (4)
|
|
17
|
+
|
|
18
|
+
readonly #inputValidator: InputValidator = InputValidator.instance;
|
|
19
|
+
readonly #logger: Logger = Logger.instance;
|
|
20
|
+
readonly #renderingEngine: RenderingEngineThreeJs;
|
|
21
|
+
readonly #viewportApi: IViewportApi;
|
|
22
|
+
|
|
23
|
+
// #endregion Properties (4)
|
|
24
|
+
|
|
25
|
+
// #region Constructors (1)
|
|
26
|
+
|
|
27
|
+
constructor(viewportApi: IViewportApi, renderingEngine: RenderingEngineThreeJs) {
|
|
28
|
+
this.#viewportApi = viewportApi;
|
|
29
|
+
this.#renderingEngine = renderingEngine;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// #endregion Constructors (1)
|
|
33
|
+
|
|
34
|
+
// #region Public Getters And Setters (14)
|
|
35
|
+
|
|
36
|
+
public get antiAliasingTechnique(): ANTI_ALIASING_TECHNIQUE {
|
|
37
|
+
return this.#renderingEngine.postProcessingManager.antiAliasingTechnique;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public set antiAliasingTechnique(value: ANTI_ALIASING_TECHNIQUE) {
|
|
41
|
+
const scope = 'antiAliasingTechnique';
|
|
42
|
+
this.#inputValidator.validateAndError(`PostProcessingApi.${scope}`, value, 'enum', true, Object.values(ANTI_ALIASING_TECHNIQUE));
|
|
43
|
+
this.#renderingEngine.postProcessingManager.antiAliasingTechnique = value;
|
|
44
|
+
this.#logger.debug(`PostProcessingApi.${scope}: ${scope} was set to: ${value}`);
|
|
45
|
+
this.#viewportApi.update();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public get antiAliasingTechniqueMobile(): ANTI_ALIASING_TECHNIQUE {
|
|
49
|
+
return this.#renderingEngine.postProcessingManager.antiAliasingTechniqueMobile;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public set antiAliasingTechniqueMobile(value: ANTI_ALIASING_TECHNIQUE) {
|
|
53
|
+
const scope = 'antiAliasingTechniqueMobile';
|
|
54
|
+
this.#inputValidator.validateAndError(`PostProcessingApi.${scope}`, value, 'enum', true, Object.values(ANTI_ALIASING_TECHNIQUE));
|
|
55
|
+
this.#renderingEngine.postProcessingManager.antiAliasingTechniqueMobile = value;
|
|
56
|
+
this.#logger.debug(`PostProcessingApi.${scope}: ${scope} was set to: ${value}`);
|
|
57
|
+
this.#viewportApi.update();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public get effectComposer(): EffectComposer | undefined {
|
|
61
|
+
return this.#renderingEngine.postProcessingManager.effectComposer;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public get enablePostProcessingOnMobile(): boolean {
|
|
65
|
+
return this.#renderingEngine.postProcessingManager.enablePostProcessingOnMobile;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public set enablePostProcessingOnMobile(value: boolean) {
|
|
69
|
+
const scope = 'enablePostProcessingOnMobile';
|
|
70
|
+
this.#inputValidator.validateAndError(`PostProcessingApi.${scope}`, value, 'boolean');
|
|
71
|
+
this.#renderingEngine.postProcessingManager.enablePostProcessingOnMobile = value;
|
|
72
|
+
this.#logger.debug(`PostProcessingApi.${scope}: ${scope} was set to: ${value}`);
|
|
73
|
+
this.#viewportApi.update();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
public get godRaysEffects(): {
|
|
77
|
+
[key: string]: {
|
|
78
|
+
setLightSource(node: ITreeNode): void;
|
|
79
|
+
removeLightSource(): void;
|
|
80
|
+
}
|
|
81
|
+
} {
|
|
82
|
+
return this.#renderingEngine.postProcessingManager.godRaysManagers;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
public get manualPostProcessing(): boolean {
|
|
86
|
+
return this.#renderingEngine.postProcessingManager.manualPostProcessing;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public set manualPostProcessing(value: boolean) {
|
|
90
|
+
const scope = 'manualPostProcessing';
|
|
91
|
+
this.#inputValidator.validateAndError(`PostProcessingApi.${scope}`, value, 'boolean');
|
|
92
|
+
this.#renderingEngine.postProcessingManager.manualPostProcessing = value;
|
|
93
|
+
this.#logger.debug(`PostProcessingApi.${scope}: ${scope} was set to: ${value}`);
|
|
94
|
+
this.#viewportApi.update();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
public get outlineEffects(): {
|
|
98
|
+
[key: string]: {
|
|
99
|
+
addSelection(node: ITreeNode): void;
|
|
100
|
+
removeSelection(node: ITreeNode): boolean;
|
|
101
|
+
clearSelection(): void;
|
|
102
|
+
}
|
|
103
|
+
} {
|
|
104
|
+
return this.#renderingEngine.postProcessingManager.outlineManagers;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
public get selectiveBloomEffects(): {
|
|
108
|
+
[key: string]: {
|
|
109
|
+
addSelection(node: ITreeNode): void;
|
|
110
|
+
removeSelection(node: ITreeNode): boolean;
|
|
111
|
+
clearSelection(): void;
|
|
112
|
+
}
|
|
113
|
+
} {
|
|
114
|
+
return this.#renderingEngine.postProcessingManager.selectiveBloomManagers;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
public get ssaaSampleLevel(): number {
|
|
118
|
+
return this.#renderingEngine.postProcessingManager.ssaaSampleLevel;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
public set ssaaSampleLevel(value: number) {
|
|
122
|
+
const scope = 'ssaaSampleLevel';
|
|
123
|
+
this.#inputValidator.validateAndError(`PostProcessingApi.${scope}`, value, 'number');
|
|
124
|
+
this.#renderingEngine.postProcessingManager.ssaaSampleLevel = value;
|
|
125
|
+
this.#logger.debug(`PostProcessingApi.${scope}: ${scope} was set to: ${value}`);
|
|
126
|
+
this.#viewportApi.update();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// #endregion Public Getters And Setters (14)
|
|
130
|
+
|
|
131
|
+
// #region Public Methods (7)
|
|
132
|
+
|
|
133
|
+
public addEffect(definition: IPostProcessingEffectDefinition): string {
|
|
134
|
+
const scope = 'addEffect';
|
|
135
|
+
this.#inputValidator.validateAndError(`PostProcessingApi.${scope}`, definition, 'object', false);
|
|
136
|
+
const res = this.#renderingEngine.postProcessingManager.addEffect(definition);
|
|
137
|
+
this.#logger.debug(`PostProcessingApi.${scope}: ${scope} was called with definition ${definition}.`);
|
|
138
|
+
this.#viewportApi.update();
|
|
139
|
+
return res;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
public getDefaultEffectProperties(type: POST_PROCESSING_EFFECT_TYPE): unknown {
|
|
143
|
+
const scope = 'getDefaultEffectProperties';
|
|
144
|
+
this.#inputValidator.validateAndError(`PostProcessingApi.${scope}`, type, 'enum', true, Object.values(POST_PROCESSING_EFFECT_TYPE));
|
|
145
|
+
this.#logger.debug(`PostProcessingApi.${scope}: ${scope} was called with type ${type}.`);
|
|
146
|
+
return this.#renderingEngine.postProcessingManager.getDefaultEffectProperties(type);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
public getEffect(token: string): Effect {
|
|
150
|
+
const scope = 'getEffect';
|
|
151
|
+
this.#inputValidator.validateAndError(`PostProcessingApi.${scope}`, token, 'string');
|
|
152
|
+
this.#logger.debug(`PostProcessingApi.${scope}: ${scope} was called with token ${token}.`);
|
|
153
|
+
return this.#renderingEngine.postProcessingManager.getEffect(token);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
public getEffectTokens(): { [key: string]: POST_PROCESSING_EFFECT_TYPE } {
|
|
157
|
+
return this.#renderingEngine.postProcessingManager.getEffectTokens();
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
public getPostProcessingEffectsArray(): IPostProcessingEffectsArray {
|
|
161
|
+
const scope = 'getPostProcessingEffectsArray';
|
|
162
|
+
this.#logger.debug(`PostProcessingApi.${scope}: ${scope} was called.`);
|
|
163
|
+
return this.#renderingEngine.postProcessingManager.getPostProcessingEffectsArray();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
public removeEffect(token: string): boolean {
|
|
167
|
+
const scope = 'removeEffect';
|
|
168
|
+
this.#inputValidator.validateAndError(`PostProcessingApi.${scope}`, token, 'string');
|
|
169
|
+
const res = this.#renderingEngine.postProcessingManager.removeEffect(token);
|
|
170
|
+
this.#logger.debug(`PostProcessingApi.${scope}: ${scope} was called with token ${token}.`);
|
|
171
|
+
this.#viewportApi.update();
|
|
172
|
+
return res;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
public updateEffect(token: string, definition: IPostProcessingEffectDefinition): void {
|
|
176
|
+
const scope = 'updateEffect';
|
|
177
|
+
this.#inputValidator.validateAndError(`PostProcessingApi.${scope}`, token, 'string');
|
|
178
|
+
this.#renderingEngine.postProcessingManager.updateEffect(token, definition);
|
|
179
|
+
this.#logger.debug(`PostProcessingApi.${scope}: ${scope} was called with token ${token} and definition ${definition}.`);
|
|
180
|
+
this.#viewportApi.update();
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// #endregion Public Methods (7)
|
|
184
|
+
}
|