@realsee/dnalogel 0.1.7-alpha.1 → 0.1.7-alpha.5
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/components/GLTFView/index.d.ts +17 -1
- package/components/GLTFView/index.js +18 -3
- package/data/81zxMaeVKLQU93OZMG.d.ts +49 -0
- package/data/81zxMaeVKLQU93OZMG.js +633 -0
- package/data/PrXel3aqGbp34JQn.js +139 -1
- package/data/vLykj3NWrllMrG06.js +335 -71
- package/libs/gltf-viewer/coordsToDirection.d.ts +1 -1
- package/libs/gltf-viewer/index.d.ts +23 -2
- package/libs/gltf-viewer/index.js +162 -50
- package/package.json +3 -3
- package/plugins/ModelChassisCompassPlugin/index.d.ts +1 -1
- package/plugins/ModelChassisCompassPlugin/index.js +2 -1
- package/plugins/ModelEntryDoorGuidePlugin/index.d.ts +4 -0
- package/plugins/ModelEntryDoorGuidePlugin/index.js +6 -1
- package/plugins/ModelRoomLabelPlugin/Controller.js +1 -0
- package/plugins/ModelRoomLabelPlugin/RoomLabelItem.js +5 -5
- package/plugins/ModelRoomLabelPlugin/index.d.ts +4 -0
- package/plugins/ModelRoomLabelPlugin/index.js +7 -2
- package/plugins/PanoMaskSelectorPlugin/fragmentShader.d.ts +1 -1
- package/plugins/PanoMaskSelectorPlugin/fragmentShader.js +1 -1
- package/plugins/PanoMeasurePlugin/Controller/BaseController.d.ts +36 -0
- package/plugins/PanoMeasurePlugin/Controller/BaseController.js +103 -0
- package/plugins/PanoMeasurePlugin/Controller/EditController.d.ts +52 -0
- package/plugins/PanoMeasurePlugin/Controller/EditController.js +341 -0
- package/plugins/PanoMeasurePlugin/Controller/ShortcutKeyController.d.ts +12 -0
- package/plugins/PanoMeasurePlugin/Controller/ShortcutKeyController.js +69 -0
- package/plugins/PanoMeasurePlugin/Controller/WatchController.d.ts +25 -0
- package/plugins/PanoMeasurePlugin/Controller/WatchController.js +371 -0
- package/plugins/PanoMeasurePlugin/Controller/index.d.ts +61 -0
- package/plugins/PanoMeasurePlugin/Controller/index.js +230 -0
- package/plugins/PanoMeasurePlugin/Model/index.d.ts +38 -0
- package/plugins/PanoMeasurePlugin/Model/index.js +235 -0
- package/plugins/PanoMeasurePlugin/Model/line.d.ts +30 -0
- package/plugins/PanoMeasurePlugin/Model/line.js +121 -0
- package/plugins/PanoMeasurePlugin/Model/point.d.ts +16 -0
- package/plugins/PanoMeasurePlugin/Model/point.js +68 -0
- package/plugins/PanoMeasurePlugin/Model/polyline.d.ts +16 -0
- package/plugins/PanoMeasurePlugin/Model/polyline.js +109 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.js +11 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.js +11 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.js +11 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +22 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/index.js +182 -0
- package/plugins/PanoMeasurePlugin/Modules/FiveHelper.d.ts +11 -0
- package/plugins/PanoMeasurePlugin/Modules/FiveHelper.js +66 -0
- package/plugins/PanoMeasurePlugin/Modules/GuideController.d.ts +18 -0
- package/plugins/PanoMeasurePlugin/Modules/GuideController.js +107 -0
- package/plugins/PanoMeasurePlugin/Modules/Magnifier.d.ts +24 -0
- package/plugins/PanoMeasurePlugin/Modules/Magnifier.js +139 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/HTML.d.ts +6 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/HTML.js +26 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/MainBtnController.d.ts +18 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +169 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/Revoke/index.d.ts +12 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +59 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/index.d.ts +16 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/index.js +123 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/style.d.ts +17 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/style.js +103 -0
- package/plugins/PanoMeasurePlugin/index.d.ts +7 -0
- package/plugins/PanoMeasurePlugin/index.js +20 -0
- package/plugins/PanoMeasurePlugin/typings/data.d.ts +28 -0
- package/plugins/PanoMeasurePlugin/typings/data.js +7 -0
- package/plugins/PanoMeasurePlugin/typings/event.type.d.ts +28 -0
- package/plugins/PanoMeasurePlugin/typings/event.type.js +7 -0
- package/plugins/PanoMeasurePlugin/typings/utils.type.d.ts +1 -0
- package/plugins/PanoMeasurePlugin/typings/utils.type.js +7 -0
- package/plugins/PanoMeasurePlugin/utils/clearGroup.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/utils/clearGroup.js +16 -0
- package/plugins/PanoMeasurePlugin/utils/constants.d.ts +4 -0
- package/plugins/PanoMeasurePlugin/utils/constants.js +47 -0
- package/plugins/PanoMeasurePlugin/utils/distanceDom.d.ts +28 -0
- package/plugins/PanoMeasurePlugin/utils/distanceDom.js +147 -0
- package/plugins/PanoMeasurePlugin/utils/findAssociatedLines.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/utils/findAssociatedLines.js +37 -0
- package/plugins/PanoMeasurePlugin/utils/findClosestPoint.d.ts +10 -0
- package/plugins/PanoMeasurePlugin/utils/findClosestPoint.js +49 -0
- package/plugins/PanoMeasurePlugin/utils/getIntersectionFromEvent.d.ts +4 -0
- package/plugins/PanoMeasurePlugin/utils/getIntersectionFromEvent.js +20 -0
- package/plugins/PanoMeasurePlugin/utils/getPointFromHammerEvent.d.ts +10 -0
- package/plugins/PanoMeasurePlugin/utils/getPointFromHammerEvent.js +33 -0
- package/plugins/PanoMeasurePlugin/utils/ironbox.d.ts +1 -0
- package/plugins/PanoMeasurePlugin/utils/ironbox.js +14 -0
- package/plugins/PanoMeasurePlugin/utils/isNDCPointInScreen.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/utils/isNDCPointInScreen.js +16 -0
- package/plugins/PanoMeasurePlugin/utils/line.d.ts +17 -0
- package/plugins/PanoMeasurePlugin/utils/line.js +61 -0
- package/plugins/PanoMeasurePlugin/utils/math.d.ts +17 -0
- package/plugins/PanoMeasurePlugin/utils/math.js +57 -0
- package/plugins/PanoMeasurePlugin/utils/mouseGroup.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/utils/mouseGroup.js +42 -0
- package/plugins/PanoMeasurePlugin/utils/ndc2Screen.d.ts +5 -0
- package/plugins/PanoMeasurePlugin/utils/ndc2Screen.js +16 -0
- package/plugins/PanoRulerPlugin/index.d.ts +4 -0
- package/plugins/PanoRulerPlugin/index.js +6 -1
- package/plugins/floorplan/ModelFloorplanPlugin/Controller.d.ts +5 -2
- package/plugins/floorplan/ModelFloorplanPlugin/Controller.js +22 -11
- package/plugins/floorplan/ModelFloorplanPlugin/components/Camera.js +4 -4
- package/plugins/floorplan/ModelFloorplanPlugin/components/Compass.js +5 -5
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomLabels.js +2 -2
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomMaterial.d.ts +11 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomMaterial.js +174 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RuleLabels.d.ts +8 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RuleLabels.js +179 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/index.d.ts +2 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/index.js +14 -2
- package/plugins/floorplan/ModelFloorplanPlugin/components/index.d.ts +3 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/index.js +1 -1
- package/plugins/floorplan/ModelFloorplanPlugin/typings/utility.d.ts +2 -0
- package/plugins/floorplan/ModelFloorplanPlugin/typings/utility.js +7 -0
- package/plugins/floorplan/ModelFloorplanPlugin/utils/constant.d.ts +1 -1
- package/plugins/floorplan/ModelFloorplanPlugin/utils/constant.js +1 -1
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.js +1 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.style.js +4 -4
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/ExtraObjects.js +2 -2
- package/plugins/floorplan/TopviewFloorplanPlugin/Controller.js +3 -3
- package/plugins/floorplan/index.d.ts +4 -0
- package/plugins/floorplan/index.js +13 -0
- package/plugins/floorplan/typings/floorplanData.d.ts +2 -0
- package/plugins/floorplan/typings/floorplanServerData.d.ts +2 -0
- package/plugins/floorplan/utils/formatData.js +2 -1
- package/shared-utils/changeModelCanvasOpacity.d.ts +2 -0
- package/shared-utils/{changeModelCanvansOpacity.js → changeModelCanvasOpacity.js} +2 -2
- package/shared-utils/removeArrayItem.d.ts +7 -0
- package/shared-utils/removeArrayItem.js +22 -0
- package/shared-utils/three/loadTexture.d.ts +2 -2
- package/shared-utils/three/loadTexture.js +21 -2
- package/shared-utils/changeModelCanvansOpacity.d.ts +0 -2
|
@@ -11,8 +11,15 @@ export interface GLTFViewerConfig {
|
|
|
11
11
|
backgroundHDR?: string;
|
|
12
12
|
pixelRatio?: number;
|
|
13
13
|
initial?: Partial<GLTFViewerState>;
|
|
14
|
-
pointLight?: THREE.PointLight;
|
|
15
|
-
directionalLight?: THREE.DirectionalLight;
|
|
14
|
+
pointLight?: THREE.PointLight | false;
|
|
15
|
+
directionalLight?: THREE.DirectionalLight | false;
|
|
16
|
+
ambientLight?: THREE.AmbientLight | false;
|
|
17
|
+
minFov?: number;
|
|
18
|
+
maxFov?: number;
|
|
19
|
+
toneMapping?: {
|
|
20
|
+
toneMapping?: THREE.ToneMapping;
|
|
21
|
+
toneMappingExposure?: number;
|
|
22
|
+
};
|
|
16
23
|
}
|
|
17
24
|
export interface GLTFViewerState {
|
|
18
25
|
fov: number;
|
|
@@ -39,9 +46,14 @@ export declare class GLTFViewer extends Subscribe<GLTFViewerEventMap> {
|
|
|
39
46
|
latitude?: number;
|
|
40
47
|
longitude?: number;
|
|
41
48
|
});
|
|
49
|
+
set minFov(fov: number);
|
|
50
|
+
get minFov(): number;
|
|
51
|
+
set maxFov(fov: number);
|
|
52
|
+
get maxFov(): number;
|
|
42
53
|
/**
|
|
43
54
|
*
|
|
44
55
|
* @param url glTF 模型CDN地址
|
|
56
|
+
* @param options adaptive 是否开启自适应fov
|
|
45
57
|
*/
|
|
46
58
|
load(url: string): void;
|
|
47
59
|
/**
|
|
@@ -50,8 +62,17 @@ export declare class GLTFViewer extends Subscribe<GLTFViewerEventMap> {
|
|
|
50
62
|
* @param size
|
|
51
63
|
*/
|
|
52
64
|
appendTo(container: HTMLDivElement, size?: GLTFViewerSize): void;
|
|
65
|
+
/**
|
|
66
|
+
* 刷新:如果传递宽高则以该宽高重新绘制;否则,以父容器的宽高重新绘制。
|
|
67
|
+
* @param size
|
|
68
|
+
*/
|
|
69
|
+
refresh(size?: GLTFViewerSize): void;
|
|
53
70
|
/**
|
|
54
71
|
* 销毁
|
|
55
72
|
*/
|
|
56
73
|
dispose(): void;
|
|
74
|
+
/**
|
|
75
|
+
* 响应式fov
|
|
76
|
+
*/
|
|
77
|
+
fitFov(): void;
|
|
57
78
|
}
|
|
@@ -23,12 +23,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
23
23
|
});
|
|
24
24
|
exports.GLTFViewer = void 0;
|
|
25
25
|
|
|
26
|
+
require("core-js/modules/es.object.assign.js");
|
|
27
|
+
|
|
26
28
|
require("core-js/modules/es.function.bind.js");
|
|
27
29
|
|
|
28
30
|
require("core-js/modules/web.timers.js");
|
|
29
31
|
|
|
30
|
-
require("core-js/modules/es.object.assign.js");
|
|
31
|
-
|
|
32
32
|
require("core-js/modules/es.object.to-string.js");
|
|
33
33
|
|
|
34
34
|
require("core-js/modules/es.promise.js");
|
|
@@ -37,10 +37,10 @@ require("core-js/modules/es.date.to-string.js");
|
|
|
37
37
|
|
|
38
38
|
require("core-js/modules/es.regexp.to-string.js");
|
|
39
39
|
|
|
40
|
-
require("core-js/modules/es.number.is-integer.js");
|
|
41
|
-
|
|
42
40
|
require("core-js/modules/es.number.constructor.js");
|
|
43
41
|
|
|
42
|
+
require("core-js/modules/es.array.concat.js");
|
|
43
|
+
|
|
44
44
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
45
45
|
|
|
46
46
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
@@ -67,8 +67,6 @@ var _coordsMoveByOffset = require("./coordsMoveByOffset");
|
|
|
67
67
|
|
|
68
68
|
var _getFrameTime = require("./getFrameTime");
|
|
69
69
|
|
|
70
|
-
var _formatRad = require("./formatRad");
|
|
71
|
-
|
|
72
70
|
var _coordsToDirection = require("./coordsToDirection");
|
|
73
71
|
|
|
74
72
|
var _mouseWheel = require("./mouseWheel");
|
|
@@ -89,8 +87,8 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
89
87
|
|
|
90
88
|
var defaultPos = {
|
|
91
89
|
longitude: 0,
|
|
92
|
-
latitude:
|
|
93
|
-
fov:
|
|
90
|
+
latitude: 0,
|
|
91
|
+
fov: 0
|
|
94
92
|
};
|
|
95
93
|
var ERROR_NO_CONTROLLER = 'GLTFViewer 实例丢失';
|
|
96
94
|
var loader = new _GLTFLoader.GLTFLoader();
|
|
@@ -100,11 +98,15 @@ var Controller = /*#__PURE__*/function () {
|
|
|
100
98
|
var _this = this;
|
|
101
99
|
|
|
102
100
|
(0, _classCallCheck2["default"])(this, Controller);
|
|
103
|
-
(0, _defineProperty2["default"])(this, "fov",
|
|
101
|
+
(0, _defineProperty2["default"])(this, "fov", 0);
|
|
104
102
|
(0, _defineProperty2["default"])(this, "longitude", 0);
|
|
105
|
-
(0, _defineProperty2["default"])(this, "latitude",
|
|
103
|
+
(0, _defineProperty2["default"])(this, "latitude", 0);
|
|
106
104
|
(0, _defineProperty2["default"])(this, "needsRender", false);
|
|
107
|
-
|
|
105
|
+
this.config = Object.assign({
|
|
106
|
+
maxFov: 120,
|
|
107
|
+
minFov: 1
|
|
108
|
+
}, config); // 异步事件回调
|
|
109
|
+
|
|
108
110
|
this.callbacks = callbacks; // 默认状态参数
|
|
109
111
|
|
|
110
112
|
var initial = config.initial || {};
|
|
@@ -134,8 +136,14 @@ var Controller = /*#__PURE__*/function () {
|
|
|
134
136
|
alpha: true
|
|
135
137
|
});
|
|
136
138
|
this.renderer.outputEncoding = THREE.sRGBEncoding;
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
|
|
140
|
+
if (config.toneMapping) {
|
|
141
|
+
var _config$toneMapping = config.toneMapping,
|
|
142
|
+
toneMapping = _config$toneMapping.toneMapping,
|
|
143
|
+
toneMappingExposure = _config$toneMapping.toneMappingExposure;
|
|
144
|
+
if (toneMapping) this.renderer.toneMapping = toneMapping;
|
|
145
|
+
if (toneMappingExposure !== undefined) this.renderer.toneMappingExposure = toneMappingExposure;
|
|
146
|
+
}
|
|
139
147
|
|
|
140
148
|
if (config.backgroundColor) {
|
|
141
149
|
this.renderer.setClearColor(config.backgroundColor, 0);
|
|
@@ -147,13 +155,24 @@ var Controller = /*#__PURE__*/function () {
|
|
|
147
155
|
} // 相机
|
|
148
156
|
|
|
149
157
|
|
|
150
|
-
this.camera = new THREE.PerspectiveCamera(this.fov, 1, 0.1,
|
|
158
|
+
this.camera = new THREE.PerspectiveCamera(this.fov, 1, 0.1, 1500); // 光照
|
|
159
|
+
|
|
160
|
+
if (config.pointLight !== false) {
|
|
161
|
+
this.pointLight = config.pointLight || new THREE.PointLight(0xfffffff, 1, 1500);
|
|
162
|
+
this.scene.add(this.pointLight);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (config.directionalLight !== false) {
|
|
166
|
+
this.directionLight = config.directionalLight || new THREE.DirectionalLight(0xfffffff, 0.1);
|
|
167
|
+
this.directionLight.position.setY(-1);
|
|
168
|
+
this.scene.add(this.directionLight);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (config.ambientLight !== false) {
|
|
172
|
+
this.ambientLight = config.ambientLight || new THREE.AmbientLight(0xfffffff);
|
|
173
|
+
this.scene.add(this.ambientLight);
|
|
174
|
+
} // 背景 HDR
|
|
151
175
|
|
|
152
|
-
this.pointLight = config.pointLight || new THREE.PointLight(0xfffffff, 0.9, 10000);
|
|
153
|
-
this.scene.add(this.pointLight);
|
|
154
|
-
this.directionLight = config.directionalLight || new THREE.DirectionalLight(0xfffffff, 0.1);
|
|
155
|
-
this.directionLight.position.setY(-1);
|
|
156
|
-
this.scene.add(this.directionLight); // 背景 HDR
|
|
157
176
|
|
|
158
177
|
if (config.backgroundHDR) {
|
|
159
178
|
var pmremGenerator = new THREE.PMREMGenerator(this.renderer);
|
|
@@ -205,6 +224,16 @@ var Controller = /*#__PURE__*/function () {
|
|
|
205
224
|
}
|
|
206
225
|
|
|
207
226
|
(0, _createClass2["default"])(Controller, [{
|
|
227
|
+
key: "minFov",
|
|
228
|
+
get: function get() {
|
|
229
|
+
return this.config.minFov || 1;
|
|
230
|
+
}
|
|
231
|
+
}, {
|
|
232
|
+
key: "maxFov",
|
|
233
|
+
get: function get() {
|
|
234
|
+
return this.config.maxFov || 120;
|
|
235
|
+
}
|
|
236
|
+
}, {
|
|
208
237
|
key: "pause",
|
|
209
238
|
value: function pause() {// nothing todo
|
|
210
239
|
}
|
|
@@ -212,8 +241,7 @@ var Controller = /*#__PURE__*/function () {
|
|
|
212
241
|
key: "clear",
|
|
213
242
|
value: function clear() {
|
|
214
243
|
if (this.target) {
|
|
215
|
-
this.scene.remove(this.target.scene);
|
|
216
|
-
|
|
244
|
+
this.scene.remove(this.target.scene);
|
|
217
245
|
this.update(defaultPos);
|
|
218
246
|
this.target = undefined;
|
|
219
247
|
}
|
|
@@ -251,6 +279,8 @@ var Controller = /*#__PURE__*/function () {
|
|
|
251
279
|
_this3.target.scene.visible = true;
|
|
252
280
|
|
|
253
281
|
_this3.update({});
|
|
282
|
+
|
|
283
|
+
_this3.callbacks.loaded(object);
|
|
254
284
|
}
|
|
255
285
|
}, 50);
|
|
256
286
|
}
|
|
@@ -310,33 +340,59 @@ var Controller = /*#__PURE__*/function () {
|
|
|
310
340
|
latitude = state.latitude;
|
|
311
341
|
}
|
|
312
342
|
|
|
313
|
-
|
|
314
|
-
var
|
|
343
|
+
if (!this.target || !this.target.scene) return;
|
|
344
|
+
var boxHelper = new THREE.BoxHelper(this.target.scene, 0x2bb8aa);
|
|
315
345
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
346
|
+
var _ref = boxHelper.geometry.boundingSphere || {},
|
|
347
|
+
center = _ref.center,
|
|
348
|
+
radius = _ref.radius;
|
|
349
|
+
|
|
350
|
+
if (!center || !radius) return;
|
|
351
|
+
var box = new THREE.Box3();
|
|
352
|
+
box.expandByObject(this.target.scene);
|
|
353
|
+
box.getCenter(center); // 距离
|
|
354
|
+
|
|
355
|
+
var distance = radius / Math.sin(Math.PI / 4) * 3;
|
|
356
|
+
{// debug
|
|
357
|
+
// const geometry = new THREE.SphereGeometry(radius, 32, 16)
|
|
358
|
+
// const material = new THREE.MeshBasicMaterial({ color: 0x0000aa, wireframe: true })
|
|
359
|
+
// const sphere = new THREE.Mesh(geometry, material)
|
|
360
|
+
// sphere.position.copy(center.clone())
|
|
361
|
+
// this.scene.add(sphere)
|
|
362
|
+
} // 朝向
|
|
320
363
|
|
|
321
|
-
longitude = (0, _formatRad.formatRad)(longitude);
|
|
322
|
-
latitude = Math.max(-Math.PI / 2 + 0.01, Math.min(+Math.PI / 2, latitude));
|
|
323
|
-
var distance = Math.max(center.distanceTo(box.min), center.distanceTo(box.max));
|
|
324
364
|
var direction = (0, _coordsToDirection.coordsToDirection)({
|
|
325
365
|
longitude: longitude,
|
|
326
366
|
latitude: latitude
|
|
327
367
|
});
|
|
328
|
-
direction.setLength(distance
|
|
368
|
+
direction.setLength(distance);
|
|
329
369
|
this.camera.position.copy(center.clone().add(direction));
|
|
330
370
|
this.camera.lookAt(center);
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
371
|
+
|
|
372
|
+
if (this.pointLight) {
|
|
373
|
+
var lightDirection = (0, _coordsToDirection.coordsToDirection)({
|
|
374
|
+
longitude: longitude,
|
|
375
|
+
latitude: -Math.PI / 6
|
|
376
|
+
});
|
|
377
|
+
lightDirection.setLength(distance * 3);
|
|
378
|
+
this.pointLight.position.copy(center.clone().add(lightDirection));
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
var calcFov = function calcFov(distance, width, r) {
|
|
382
|
+
var vertical = r < 1 ? width / r : width;
|
|
383
|
+
var fov = Math.atan(vertical / distance / 2) * 2 * (180 / Math.PI);
|
|
384
|
+
return fov;
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
var d = this.camera.position.distanceTo(center);
|
|
388
|
+
|
|
389
|
+
if (fov === 0) {
|
|
390
|
+
fov = calcFov(d, radius * 2, this.renderer.domElement.offsetWidth / this.renderer.domElement.offsetHeight);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
fov = Math.max(this.minFov, Math.min(this.maxFov, fov));
|
|
337
394
|
|
|
338
395
|
if (fov !== this.fov) {
|
|
339
|
-
fov = Math.max(25, Math.min(60, fov));
|
|
340
396
|
this.camera.fov = fov;
|
|
341
397
|
this.camera.updateProjectionMatrix();
|
|
342
398
|
}
|
|
@@ -439,8 +495,9 @@ var Controller = /*#__PURE__*/function () {
|
|
|
439
495
|
return;
|
|
440
496
|
}
|
|
441
497
|
|
|
498
|
+
var fov = this.__pinchCurrentFov ? this.__pinchCurrentFov / scale : 1;
|
|
442
499
|
this.update({
|
|
443
|
-
fov:
|
|
500
|
+
fov: fov
|
|
444
501
|
});
|
|
445
502
|
}
|
|
446
503
|
}, {
|
|
@@ -482,8 +539,9 @@ var Controller = /*#__PURE__*/function () {
|
|
|
482
539
|
key: "__onMouseWheel",
|
|
483
540
|
value: function __onMouseWheel(event) {
|
|
484
541
|
this.__interiaMovement = false;
|
|
542
|
+
var fov = this.fov - event.delta;
|
|
485
543
|
this.update({
|
|
486
|
-
fov:
|
|
544
|
+
fov: fov <= 1 ? 1 : fov
|
|
487
545
|
});
|
|
488
546
|
}
|
|
489
547
|
}, {
|
|
@@ -497,8 +555,6 @@ var Controller = /*#__PURE__*/function () {
|
|
|
497
555
|
loader.load(url, function (gltf) {
|
|
498
556
|
_this6.setTarget(gltf);
|
|
499
557
|
|
|
500
|
-
_this6.callbacks.loaded(gltf);
|
|
501
|
-
|
|
502
558
|
resolve(true);
|
|
503
559
|
}, function (xhr) {
|
|
504
560
|
_this6.callbacks.progressing(xhr.loaded / xhr.total * 100);
|
|
@@ -558,6 +614,9 @@ var GLTFViewer = /*#__PURE__*/function (_Subscribe) {
|
|
|
558
614
|
return _this7.emit('loadError', error);
|
|
559
615
|
}
|
|
560
616
|
});
|
|
617
|
+
Object.assign(window, {
|
|
618
|
+
$controller: controller
|
|
619
|
+
});
|
|
561
620
|
caches[_this7.uuid] = controller;
|
|
562
621
|
return _this7;
|
|
563
622
|
}
|
|
@@ -574,12 +633,12 @@ var GLTFViewer = /*#__PURE__*/function (_Subscribe) {
|
|
|
574
633
|
}, {
|
|
575
634
|
set: function set(obj, prop, value) {
|
|
576
635
|
if (prop === 'fov') {
|
|
577
|
-
if (
|
|
636
|
+
if (Number(value) === NaN) {
|
|
578
637
|
throw new TypeError('The fov is not an number');
|
|
579
638
|
}
|
|
580
639
|
|
|
581
|
-
if (value >
|
|
582
|
-
throw new RangeError(
|
|
640
|
+
if (value > controller.maxFov || value < controller.minFov) {
|
|
641
|
+
throw new RangeError("The fov seems invalid~ fov: [".concat(controller.minFov, ", ").concat(controller.maxFov, "]"));
|
|
583
642
|
}
|
|
584
643
|
}
|
|
585
644
|
|
|
@@ -592,10 +651,10 @@ var GLTFViewer = /*#__PURE__*/function (_Subscribe) {
|
|
|
592
651
|
});
|
|
593
652
|
return proxy;
|
|
594
653
|
},
|
|
595
|
-
set: function set(
|
|
596
|
-
var fov =
|
|
597
|
-
latitude =
|
|
598
|
-
longitude =
|
|
654
|
+
set: function set(_ref2) {
|
|
655
|
+
var fov = _ref2.fov,
|
|
656
|
+
latitude = _ref2.latitude,
|
|
657
|
+
longitude = _ref2.longitude;
|
|
599
658
|
var controller = caches[this.uuid];
|
|
600
659
|
if (!controller) throw new Error(ERROR_NO_CONTROLLER);
|
|
601
660
|
controller.update({
|
|
@@ -604,11 +663,39 @@ var GLTFViewer = /*#__PURE__*/function (_Subscribe) {
|
|
|
604
663
|
longitude: longitude === undefined ? controller.longitude : longitude
|
|
605
664
|
});
|
|
606
665
|
}
|
|
666
|
+
}, {
|
|
667
|
+
key: "minFov",
|
|
668
|
+
get: function get() {
|
|
669
|
+
var controller = caches[this.uuid];
|
|
670
|
+
if (!controller) throw new Error(ERROR_NO_CONTROLLER);
|
|
671
|
+
return controller.minFov;
|
|
672
|
+
},
|
|
673
|
+
set: function set(fov) {
|
|
674
|
+
var controller = caches[this.uuid];
|
|
675
|
+
if (!controller) throw new Error(ERROR_NO_CONTROLLER);
|
|
676
|
+
controller.config.minFov = fov;
|
|
677
|
+
controller.update({});
|
|
678
|
+
}
|
|
679
|
+
}, {
|
|
680
|
+
key: "maxFov",
|
|
681
|
+
get: function get() {
|
|
682
|
+
var controller = caches[this.uuid];
|
|
683
|
+
if (!controller) throw new Error(ERROR_NO_CONTROLLER);
|
|
684
|
+
return controller.maxFov;
|
|
685
|
+
}
|
|
607
686
|
/**
|
|
608
687
|
*
|
|
609
688
|
* @param url glTF 模型CDN地址
|
|
689
|
+
* @param options adaptive 是否开启自适应fov
|
|
610
690
|
*/
|
|
611
|
-
|
|
691
|
+
,
|
|
692
|
+
set: function set(fov) {
|
|
693
|
+
var controller = caches[this.uuid];
|
|
694
|
+
if (!controller) throw new Error(ERROR_NO_CONTROLLER);
|
|
695
|
+
console.log('maxFov', controller.config);
|
|
696
|
+
controller.config.maxFov = fov;
|
|
697
|
+
controller.update({});
|
|
698
|
+
}
|
|
612
699
|
}, {
|
|
613
700
|
key: "load",
|
|
614
701
|
value: function load(url) {
|
|
@@ -629,6 +716,18 @@ var GLTFViewer = /*#__PURE__*/function (_Subscribe) {
|
|
|
629
716
|
if (!controller) throw new Error(ERROR_NO_CONTROLLER);
|
|
630
717
|
controller.appendTo(container, size);
|
|
631
718
|
}
|
|
719
|
+
/**
|
|
720
|
+
* 刷新:如果传递宽高则以该宽高重新绘制;否则,以父容器的宽高重新绘制。
|
|
721
|
+
* @param size
|
|
722
|
+
*/
|
|
723
|
+
|
|
724
|
+
}, {
|
|
725
|
+
key: "refresh",
|
|
726
|
+
value: function refresh(size) {
|
|
727
|
+
var controller = caches[this.uuid];
|
|
728
|
+
if (!controller) throw new Error(ERROR_NO_CONTROLLER);
|
|
729
|
+
controller.refresh(size);
|
|
730
|
+
}
|
|
632
731
|
/**
|
|
633
732
|
* 销毁
|
|
634
733
|
*/
|
|
@@ -641,6 +740,19 @@ var GLTFViewer = /*#__PURE__*/function (_Subscribe) {
|
|
|
641
740
|
if (controller.dispose) controller.dispose();
|
|
642
741
|
delete caches[this.uuid];
|
|
643
742
|
}
|
|
743
|
+
/**
|
|
744
|
+
* 响应式fov
|
|
745
|
+
*/
|
|
746
|
+
|
|
747
|
+
}, {
|
|
748
|
+
key: "fitFov",
|
|
749
|
+
value: function fitFov() {
|
|
750
|
+
var controller = caches[this.uuid];
|
|
751
|
+
if (!controller) throw new Error(ERROR_NO_CONTROLLER);
|
|
752
|
+
controller.update({
|
|
753
|
+
fov: 0
|
|
754
|
+
});
|
|
755
|
+
}
|
|
644
756
|
}]);
|
|
645
757
|
return GLTFViewer;
|
|
646
758
|
}(_Subscribe2.Subscribe);
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@realsee/dnalogel",
|
|
3
|
-
"version": "0.1.7-alpha.
|
|
4
|
-
"description": "如视前端
|
|
3
|
+
"version": "0.1.7-alpha.5",
|
|
4
|
+
"description": "如视前端 Components、Plugins 兼部分 SDKs \"Dnalogel\" 库。",
|
|
5
5
|
"author": "BEIKE REALSEE TECHNOLOGY (HK) LIMITED",
|
|
6
6
|
"peerDependencies": {
|
|
7
|
-
"@realsee/five": "^5.0.0-alpha.
|
|
7
|
+
"@realsee/five": "^5.0.0-alpha.84",
|
|
8
8
|
"@tweenjs/tween.js": "^18.6.4",
|
|
9
9
|
"@types/styled-jsx": "^2.2.9",
|
|
10
10
|
"hammerjs": "^2.0.8",
|
|
@@ -15,5 +15,5 @@ export interface ModelChassisCompassPluginExportType {
|
|
|
15
15
|
/**
|
|
16
16
|
* 模型底盘指南针插件
|
|
17
17
|
*/
|
|
18
|
-
declare const ModelChassisCompassPlugin: FivePlugin<ModelChassisCompassPluginParameterType, ModelChassisCompassPluginExportType>;
|
|
18
|
+
export declare const ModelChassisCompassPlugin: FivePlugin<ModelChassisCompassPluginParameterType, ModelChassisCompassPluginExportType>;
|
|
19
19
|
export default ModelChassisCompassPlugin;
|
|
@@ -21,7 +21,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
21
21
|
Object.defineProperty(exports, "__esModule", {
|
|
22
22
|
value: true
|
|
23
23
|
});
|
|
24
|
-
exports["default"] = void 0;
|
|
24
|
+
exports["default"] = exports.ModelChassisCompassPlugin = void 0;
|
|
25
25
|
|
|
26
26
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
27
27
|
|
|
@@ -153,5 +153,6 @@ var ModelChassisCompassPlugin = function ModelChassisCompassPlugin(five, params)
|
|
|
153
153
|
};
|
|
154
154
|
};
|
|
155
155
|
|
|
156
|
+
exports.ModelChassisCompassPlugin = ModelChassisCompassPlugin;
|
|
156
157
|
var _default = ModelChassisCompassPlugin;
|
|
157
158
|
exports["default"] = _default;
|
|
@@ -19,4 +19,8 @@ export interface ModelEntryDoorGuidePluginExportType {
|
|
|
19
19
|
* 模型入户门引导插件
|
|
20
20
|
*/
|
|
21
21
|
declare const ModelEntryDoorGuidePlugin: FivePlugin<ModelEntryDoorGuidePluginParameterType, ModelEntryDoorGuidePluginExportType>;
|
|
22
|
+
export declare const modelEntryDoorGuidePluginServerParams: {
|
|
23
|
+
name: string;
|
|
24
|
+
version: number;
|
|
25
|
+
};
|
|
22
26
|
export default ModelEntryDoorGuidePlugin;
|
|
@@ -19,7 +19,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
19
19
|
Object.defineProperty(exports, "__esModule", {
|
|
20
20
|
value: true
|
|
21
21
|
});
|
|
22
|
-
exports["default"] = void 0;
|
|
22
|
+
exports.modelEntryDoorGuidePluginServerParams = exports["default"] = void 0;
|
|
23
23
|
|
|
24
24
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
25
25
|
|
|
@@ -243,5 +243,10 @@ var ModelEntryDoorGuidePlugin = function ModelEntryDoorGuidePlugin(five, params)
|
|
|
243
243
|
};
|
|
244
244
|
};
|
|
245
245
|
|
|
246
|
+
var modelEntryDoorGuidePluginServerParams = {
|
|
247
|
+
name: 'ModelEntryDoorGuidePlugin',
|
|
248
|
+
version: 0
|
|
249
|
+
};
|
|
250
|
+
exports.modelEntryDoorGuidePluginServerParams = modelEntryDoorGuidePluginServerParams;
|
|
246
251
|
var _default = ModelEntryDoorGuidePlugin;
|
|
247
252
|
exports["default"] = _default;
|
|
@@ -71,6 +71,7 @@ var ModelRoomLabelController = /*#__PURE__*/function () {
|
|
|
71
71
|
this.container.style.width = '100%';
|
|
72
72
|
this.container.style.height = '100%';
|
|
73
73
|
this.container.style.position = 'absolute';
|
|
74
|
+
this.container.style.pointerEvents = 'none';
|
|
74
75
|
this.container.style.left = '0';
|
|
75
76
|
this.container.style.top = '0'; // five lisenter
|
|
76
77
|
|
|
@@ -50,14 +50,14 @@ function RoomLabelItem(props, ref) {
|
|
|
50
50
|
return /*#__PURE__*/React.createElement("div", {
|
|
51
51
|
onClick: handleClick,
|
|
52
52
|
ref: ref,
|
|
53
|
-
className: _style["default"].dynamic([["
|
|
53
|
+
className: _style["default"].dynamic([["312299051", [(0, _px2rem["default"])(roomName.length > 3 ? 8 : 10), (0, _px2rem["default"])(-64), (0, _px2rem["default"])(20), (0, _px2rem["default"])(32), (0, _px2rem["default"])(6), (0, _px2rem["default"])(-44), (0, _px2rem["default"])(48), (0, _px2rem["default"])(1)]]]) + " " + "room-guid-label-plugin__item"
|
|
54
54
|
}, /*#__PURE__*/React.createElement(_style["default"], {
|
|
55
|
-
id: "
|
|
55
|
+
id: "312299051",
|
|
56
56
|
dynamic: [(0, _px2rem["default"])(roomName.length > 3 ? 8 : 10), (0, _px2rem["default"])(-64), (0, _px2rem["default"])(20), (0, _px2rem["default"])(32), (0, _px2rem["default"])(6), (0, _px2rem["default"])(-44), (0, _px2rem["default"])(48), (0, _px2rem["default"])(1)]
|
|
57
|
-
}, [".room-guid-label-plugin__item.__jsx-style-dynamic-selector{position:absolute;z-index:0;font-size:".concat((0, _px2rem["default"])(roomName.length > 3 ? 8 : 10), ";-webkit-transform:'';-ms-transform:'';transform:'';cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}"), ".room-guid-label-plugin__item-text.__jsx-style-dynamic-selector{position:absolute;left:0;top:".concat((0, _px2rem["default"])(-64), ";-webkit-transform:translate(-50%,0);-ms-transform:translate(-50%,0);transform:translate(-50%,0);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:").concat((0, _px2rem["default"])(20), ";min-width:").concat((0, _px2rem["default"])(32), ";padding:0 ").concat((0, _px2rem["default"])(6), ";pointer-events:all;background:url('//vrlab-static.ljcdn.com/release/web/room-label-bg.23e9d038.png') no-repeat;background-size:100% 100%;white-space:nowrap;}"), ".room-guid-label-plugin__item-bar.__jsx-style-dynamic-selector{position:absolute;top:".concat((0, _px2rem["default"])(-44), ";height:").concat((0, _px2rem["default"])(48), ";width:").concat((0, _px2rem["default"])(1), ";background-image:linear-gradient(to bottom,rgba(255,255,255,1),rgba(255,255,255,0));}")]), /*#__PURE__*/React.createElement("span", {
|
|
58
|
-
className: _style["default"].dynamic([["
|
|
57
|
+
}, [".room-guid-label-plugin__item.__jsx-style-dynamic-selector{position:absolute;z-index:0;font-size:".concat((0, _px2rem["default"])(roomName.length > 3 ? 8 : 10), ";-webkit-transform:'';-ms-transform:'';transform:'';cursor:pointer;point-events:auto;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}"), ".room-guid-label-plugin__item-text.__jsx-style-dynamic-selector{position:absolute;left:0;top:".concat((0, _px2rem["default"])(-64), ";-webkit-transform:translate(-50%,0);-ms-transform:translate(-50%,0);transform:translate(-50%,0);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:").concat((0, _px2rem["default"])(20), ";min-width:").concat((0, _px2rem["default"])(32), ";padding:0 ").concat((0, _px2rem["default"])(6), ";pointer-events:all;background:url('//vrlab-static.ljcdn.com/release/web/room-label-bg.23e9d038.png') no-repeat;background-size:100% 100%;white-space:nowrap;}"), ".room-guid-label-plugin__item-bar.__jsx-style-dynamic-selector{position:absolute;top:".concat((0, _px2rem["default"])(-44), ";height:").concat((0, _px2rem["default"])(48), ";width:").concat((0, _px2rem["default"])(1), ";background-image:linear-gradient(to bottom,rgba(255,255,255,1),rgba(255,255,255,0));}")]), /*#__PURE__*/React.createElement("span", {
|
|
58
|
+
className: _style["default"].dynamic([["312299051", [(0, _px2rem["default"])(roomName.length > 3 ? 8 : 10), (0, _px2rem["default"])(-64), (0, _px2rem["default"])(20), (0, _px2rem["default"])(32), (0, _px2rem["default"])(6), (0, _px2rem["default"])(-44), (0, _px2rem["default"])(48), (0, _px2rem["default"])(1)]]]) + " " + "room-guid-label-plugin__item-text"
|
|
59
59
|
}, roomName), /*#__PURE__*/React.createElement("div", {
|
|
60
|
-
className: _style["default"].dynamic([["
|
|
60
|
+
className: _style["default"].dynamic([["312299051", [(0, _px2rem["default"])(roomName.length > 3 ? 8 : 10), (0, _px2rem["default"])(-64), (0, _px2rem["default"])(20), (0, _px2rem["default"])(32), (0, _px2rem["default"])(6), (0, _px2rem["default"])(-44), (0, _px2rem["default"])(48), (0, _px2rem["default"])(1)]]]) + " " + "room-guid-label-plugin__item-bar"
|
|
61
61
|
}));
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -2,6 +2,10 @@ import { FivePlugin } from '@realsee/five';
|
|
|
2
2
|
import { ModelRoomLabelController, ModelRoomLabelPluginParameters } from './Controller';
|
|
3
3
|
export declare const ModelRoomLabelPlugin: FivePlugin<ModelRoomLabelPluginParameters, ModelRoomLabelPluginReturnType>;
|
|
4
4
|
export default ModelRoomLabelPlugin;
|
|
5
|
+
export declare const modelRoomLabelPluginServerParams: {
|
|
6
|
+
name: string;
|
|
7
|
+
version: number;
|
|
8
|
+
};
|
|
5
9
|
export type { ModelRoomLabelController } from './Controller';
|
|
6
10
|
export type { ModelRoomLabelPluginData, RoomLabel } from './typings';
|
|
7
11
|
export declare type ModelRoomLabelPluginReturnType = ModelRoomLabelController;
|
|
@@ -5,7 +5,7 @@ require("core-js/modules/es.object.define-property.js");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports["default"] = exports.ModelRoomLabelPlugin = void 0;
|
|
8
|
+
exports.modelRoomLabelPluginServerParams = exports["default"] = exports.ModelRoomLabelPlugin = void 0;
|
|
9
9
|
|
|
10
10
|
var _Controller = require("./Controller");
|
|
11
11
|
|
|
@@ -15,4 +15,9 @@ var ModelRoomLabelPlugin = function ModelRoomLabelPlugin(five) {
|
|
|
15
15
|
|
|
16
16
|
exports.ModelRoomLabelPlugin = ModelRoomLabelPlugin;
|
|
17
17
|
var _default = ModelRoomLabelPlugin;
|
|
18
|
-
exports["default"] = _default;
|
|
18
|
+
exports["default"] = _default;
|
|
19
|
+
var modelRoomLabelPluginServerParams = {
|
|
20
|
+
name: 'ModelRoomLabelPlugin',
|
|
21
|
+
version: 0
|
|
22
|
+
};
|
|
23
|
+
exports.modelRoomLabelPluginServerParams = modelRoomLabelPluginServerParams;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const fragmentShader = "\nconst float PI = 3.1415926535897932384626433832795;\nuniform int enable;\nuniform sampler2D map;\nvarying vec2 vUv;\n\nuniform vec3 selectedColor;\nuniform vec3 maskColor;\nuniform float opacity;\nuniform float thickness;\n\n\n// \u5224\u65AD\u4E24\u4E2A\u989C\u8272\u662F\u5426\u76F8\u4F3C\nbool compare(vec3 c1, vec3 c2, float threshold) {\n // \u8272\u503C\u8BEF\u5DEE 0.05\n float diff = threshold;\n\n float r = abs(c1.x - c2.x);\n float g = abs(c1.y - c2.y);\n float b = abs(c1.z - c2.z);\n\n return r < diff && g < diff && b < diff;\n}\n\nvoid main(void) {\n vec3 color = texture2D(map, vUv).xyz;\n float alpha = texture2D(map, vUv).a;\n\n gl_FragColor = vec4(color,
|
|
1
|
+
export declare const fragmentShader = "\nconst float PI = 3.1415926535897932384626433832795;\nuniform int enable;\nuniform sampler2D map;\nvarying vec2 vUv;\n\nuniform vec3 selectedColor;\nuniform vec3 maskColor;\nuniform float opacity;\nuniform float thickness;\n\n\n// \u5224\u65AD\u4E24\u4E2A\u989C\u8272\u662F\u5426\u76F8\u4F3C\nbool compare(vec3 c1, vec3 c2, float threshold) {\n // \u8272\u503C\u8BEF\u5DEE 0.05\n float diff = threshold;\n\n float r = abs(c1.x - c2.x);\n float g = abs(c1.y - c2.y);\n float b = abs(c1.z - c2.z);\n\n return r < diff && g < diff && b < diff;\n}\n\nvoid main(void) {\n vec3 color = texture2D(map, vUv).xyz;\n float alpha = texture2D(map, vUv).a;\n\n gl_FragColor = vec4(color, opacity);\n\n // \u5F00\u5173\n if (enable != 1) {\n gl_FragColor = vec4(color, opacity);\n return;\n }\n\n // \u9ED8\u8BA4\u503C\uFF1A\u672A\u63D0\u4F9B \u9009\u4E2D\u8272\u503C\n if (selectedColor.x == 0.0 && selectedColor.y == 0.0 && selectedColor.z == 0.0) {\n gl_FragColor = vec4(color, opacity);\n return;\n }\n\n bool similar = compare(color, selectedColor, 0.025);\n\n // \u4E0D\u76F8\u4F3C\n if (similar == false) {\n gl_FragColor = vec4(color, opacity);\n return;\n }\n\n // \u5BF9\u6BD4\u534A\u5F84\u5E45\u5EA6\n float offset1 = thickness;\n float offset2 = offset1 * sin(PI/4.0);\n\n vec3 top = texture2D(map, vec2(vUv.x, vUv.y + offset1)).xyz;\n vec3 right = texture2D(map, vec2(vUv.x + offset1, vUv.y)).xyz;\n vec3 bottom = texture2D(map, vec2(vUv.x, vUv.y - offset1)).xyz;\n vec3 left = texture2D(map, vec2(vUv.x - offset1, vUv.y)).xyz;\n \n vec3 topRight = texture2D(map, vec2(vUv.x + offset2, vUv.y + offset2)).xyz;\n vec3 rightBottom = texture2D(map, vec2(vUv.x + offset2, vUv.y - offset2)).xyz;\n vec3 bottomLeft = texture2D(map, vec2(vUv.x - offset2, vUv.y - offset2)).xyz;\n vec3 leftTop = texture2D(map, vec2(vUv.x - offset2, vUv.y + offset2)).xyz;\n\n float threshold = 0.0025;\n bool a1 = compare(color, top, threshold);\n bool b1 = compare(color, right, threshold);\n bool c1 = compare(color, bottom, threshold);\n bool d1 = compare(color, left, threshold);\n\n\n bool a2 = compare(color, topRight, threshold);\n bool b2 = compare(color, rightBottom, threshold);\n bool c2 = compare(color, bottomLeft, threshold);\n bool d2 = compare(color, leftTop, threshold);\n\n if (a1 == true && b1 == true && c1 == true && d1 == true && a2 == true && b2 == true && c2 == true && d2 == true) {\n gl_FragColor = vec4(color, opacity);\n return;\n }\n\n gl_FragColor = vec4(maskColor.x, maskColor.y, maskColor.z, 1.0);\n // gl_FragColor = vec4(154.0 / 255.0, 205.0 / 255.0, 50.0 / 255.0, 1.0) ;\n // gl_FragColor = vec4(139.0 / 255.0, 0.0 / 255.0, 0.0 / 255.0, 1.0) ;\n // gl_FragColor = vec4(255.0 / 255.0, 235.0 / 255.0, 59.0 / 255.0, 1.0) ;\n\n}\n";
|
|
@@ -6,5 +6,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.fragmentShader = void 0;
|
|
9
|
-
var fragmentShader = "\nconst float PI = 3.1415926535897932384626433832795;\nuniform int enable;\nuniform sampler2D map;\nvarying vec2 vUv;\n\nuniform vec3 selectedColor;\nuniform vec3 maskColor;\nuniform float opacity;\nuniform float thickness;\n\n\n// \u5224\u65AD\u4E24\u4E2A\u989C\u8272\u662F\u5426\u76F8\u4F3C\nbool compare(vec3 c1, vec3 c2, float threshold) {\n // \u8272\u503C\u8BEF\u5DEE 0.05\n float diff = threshold;\n\n float r = abs(c1.x - c2.x);\n float g = abs(c1.y - c2.y);\n float b = abs(c1.z - c2.z);\n\n return r < diff && g < diff && b < diff;\n}\n\nvoid main(void) {\n vec3 color = texture2D(map, vUv).xyz;\n float alpha = texture2D(map, vUv).a;\n\n gl_FragColor = vec4(color,
|
|
9
|
+
var fragmentShader = "\nconst float PI = 3.1415926535897932384626433832795;\nuniform int enable;\nuniform sampler2D map;\nvarying vec2 vUv;\n\nuniform vec3 selectedColor;\nuniform vec3 maskColor;\nuniform float opacity;\nuniform float thickness;\n\n\n// \u5224\u65AD\u4E24\u4E2A\u989C\u8272\u662F\u5426\u76F8\u4F3C\nbool compare(vec3 c1, vec3 c2, float threshold) {\n // \u8272\u503C\u8BEF\u5DEE 0.05\n float diff = threshold;\n\n float r = abs(c1.x - c2.x);\n float g = abs(c1.y - c2.y);\n float b = abs(c1.z - c2.z);\n\n return r < diff && g < diff && b < diff;\n}\n\nvoid main(void) {\n vec3 color = texture2D(map, vUv).xyz;\n float alpha = texture2D(map, vUv).a;\n\n gl_FragColor = vec4(color, opacity);\n\n // \u5F00\u5173\n if (enable != 1) {\n gl_FragColor = vec4(color, opacity);\n return;\n }\n\n // \u9ED8\u8BA4\u503C\uFF1A\u672A\u63D0\u4F9B \u9009\u4E2D\u8272\u503C\n if (selectedColor.x == 0.0 && selectedColor.y == 0.0 && selectedColor.z == 0.0) {\n gl_FragColor = vec4(color, opacity);\n return;\n }\n\n bool similar = compare(color, selectedColor, 0.025);\n\n // \u4E0D\u76F8\u4F3C\n if (similar == false) {\n gl_FragColor = vec4(color, opacity);\n return;\n }\n\n // \u5BF9\u6BD4\u534A\u5F84\u5E45\u5EA6\n float offset1 = thickness;\n float offset2 = offset1 * sin(PI/4.0);\n\n vec3 top = texture2D(map, vec2(vUv.x, vUv.y + offset1)).xyz;\n vec3 right = texture2D(map, vec2(vUv.x + offset1, vUv.y)).xyz;\n vec3 bottom = texture2D(map, vec2(vUv.x, vUv.y - offset1)).xyz;\n vec3 left = texture2D(map, vec2(vUv.x - offset1, vUv.y)).xyz;\n \n vec3 topRight = texture2D(map, vec2(vUv.x + offset2, vUv.y + offset2)).xyz;\n vec3 rightBottom = texture2D(map, vec2(vUv.x + offset2, vUv.y - offset2)).xyz;\n vec3 bottomLeft = texture2D(map, vec2(vUv.x - offset2, vUv.y - offset2)).xyz;\n vec3 leftTop = texture2D(map, vec2(vUv.x - offset2, vUv.y + offset2)).xyz;\n\n float threshold = 0.0025;\n bool a1 = compare(color, top, threshold);\n bool b1 = compare(color, right, threshold);\n bool c1 = compare(color, bottom, threshold);\n bool d1 = compare(color, left, threshold);\n\n\n bool a2 = compare(color, topRight, threshold);\n bool b2 = compare(color, rightBottom, threshold);\n bool c2 = compare(color, bottomLeft, threshold);\n bool d2 = compare(color, leftTop, threshold);\n\n if (a1 == true && b1 == true && c1 == true && d1 == true && a2 == true && b2 == true && c2 == true && d2 == true) {\n gl_FragColor = vec4(color, opacity);\n return;\n }\n\n gl_FragColor = vec4(maskColor.x, maskColor.y, maskColor.z, 1.0);\n // gl_FragColor = vec4(154.0 / 255.0, 205.0 / 255.0, 50.0 / 255.0, 1.0) ;\n // gl_FragColor = vec4(139.0 / 255.0, 0.0 / 255.0, 0.0 / 255.0, 1.0) ;\n // gl_FragColor = vec4(255.0 / 255.0, 235.0 / 255.0, 59.0 / 255.0, 1.0) ;\n\n}\n";
|
|
10
10
|
exports.fragmentShader = fragmentShader;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import Line from '../Model/line';
|
|
2
|
+
import Magnifier from '../Modules/Magnifier';
|
|
3
|
+
import FiveHelper from '../Modules/FiveHelper';
|
|
4
|
+
import { Group } from 'three';
|
|
5
|
+
import { Model } from '../Model';
|
|
6
|
+
import { PluginEvent } from '../typings/event.type';
|
|
7
|
+
import { Five, Intersection, IntersectMeshInterface, Subscribe } from '@realsee/five';
|
|
8
|
+
import { UserDistanceItem } from '../utils/distanceDom';
|
|
9
|
+
export interface IControllerParams {
|
|
10
|
+
five: Five;
|
|
11
|
+
group: Group;
|
|
12
|
+
model: Model;
|
|
13
|
+
mouseGroup: Group;
|
|
14
|
+
container: Element;
|
|
15
|
+
magnifier: Magnifier;
|
|
16
|
+
fiveHelper: FiveHelper;
|
|
17
|
+
hook: Subscribe<PluginEvent>;
|
|
18
|
+
userDistanceItemCreator?: () => UserDistanceItem;
|
|
19
|
+
}
|
|
20
|
+
export default abstract class BaseController {
|
|
21
|
+
protected five: Five;
|
|
22
|
+
protected group: Group;
|
|
23
|
+
protected model: Model;
|
|
24
|
+
protected disposed: boolean;
|
|
25
|
+
protected mouseGroup: Group;
|
|
26
|
+
protected container: Element;
|
|
27
|
+
protected fiveHelper: FiveHelper;
|
|
28
|
+
protected hook: IControllerParams['hook'];
|
|
29
|
+
protected magnifier: IControllerParams['magnifier'];
|
|
30
|
+
protected userDistanceItemCreator: IControllerParams['userDistanceItemCreator'];
|
|
31
|
+
constructor(params: IControllerParams);
|
|
32
|
+
protected removeLine(line: Line): void;
|
|
33
|
+
protected updateDistanceUI: () => void;
|
|
34
|
+
protected updateMouseGroup(intersection: Intersection, mesh?: IntersectMeshInterface): Group;
|
|
35
|
+
protected dispose(): void;
|
|
36
|
+
}
|