@realsee/dnalogel 0.1.5 → 0.1.7-alpha.11
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/ARVideoFigure/ImgBgTransparentMesh.js +2 -2
- package/components/GLTFView/index.d.ts +123 -0
- package/components/GLTFView/index.js +204 -0
- package/components/GlassFilters/index.js +2 -2
- package/components/ModelView/ModelViewController.js +6 -5
- package/data/81zxMaeVKLQU93OZMG.d.ts +49 -0
- package/data/81zxMaeVKLQU93OZMG.js +633 -0
- package/data/PrXel3aqGbp34JQn.js +139 -1
- package/data/_vLykj3NWrllMrG06.d.ts +95 -0
- package/data/_vLykj3NWrllMrG06.js +1 -0
- package/data/vLykj3NWrllMrG06.js +335 -71
- package/libs/gltf-viewer/Subscribe.d.ts +76 -0
- package/libs/gltf-viewer/Subscribe.js +233 -0
- package/libs/gltf-viewer/coordsMoveByOffset.d.ts +13 -0
- package/libs/gltf-viewer/coordsMoveByOffset.js +22 -0
- package/libs/gltf-viewer/coordsToDirection.d.ts +5 -0
- package/{components/PBRView/index.js → libs/gltf-viewer/coordsToDirection.js} +14 -18
- package/libs/gltf-viewer/formatRad.d.ts +1 -0
- package/libs/gltf-viewer/formatRad.js +13 -0
- package/libs/gltf-viewer/getFrameTime.d.ts +1 -0
- package/libs/gltf-viewer/getFrameTime.js +28 -0
- package/libs/gltf-viewer/index.d.ts +79 -0
- package/libs/gltf-viewer/index.js +765 -0
- package/libs/gltf-viewer/mouseWheel.d.ts +2 -0
- package/libs/gltf-viewer/mouseWheel.js +59 -0
- package/libs/gltf-viewer/requestAnimationFrame.d.ts +1 -0
- package/libs/gltf-viewer/requestAnimationFrame.js +18 -0
- package/libs/gltf-viewer/requestAnimationFrameInterval.d.ts +1 -0
- package/libs/gltf-viewer/requestAnimationFrameInterval.js +31 -0
- package/libs/gltf-viewer/uuid.d.ts +4 -0
- package/libs/gltf-viewer/uuid.js +28 -0
- package/package.json +5 -4
- package/plugins/CSS3DRenderPlugin/components/Marker/index.js +2 -0
- package/plugins/CSS3DRenderPlugin/index.js +17 -12
- package/plugins/CSS3DRenderPlugin/utils/createResizeObserver.d.ts +7 -0
- package/plugins/CSS3DRenderPlugin/utils/createResizeObserver.js +34 -0
- package/plugins/ModelChassisCompassPlugin/index.d.ts +1 -1
- package/plugins/ModelChassisCompassPlugin/index.js +2 -1
- package/plugins/ModelEntryDoorGuidePlugin/index.d.ts +6 -2
- package/plugins/ModelEntryDoorGuidePlugin/index.js +28 -19
- package/plugins/ModelExtrudeWallsPlugin/index.js +2 -2
- package/plugins/ModelRoomLabelPlugin/Controller.js +1 -0
- package/plugins/ModelRoomLabelPlugin/RoomLabelItem.js +5 -5
- package/plugins/ModelRoomLabelPlugin/RoomLabelItems.js +2 -2
- package/plugins/ModelRoomLabelPlugin/index.d.ts +4 -0
- package/plugins/ModelRoomLabelPlugin/index.js +7 -2
- package/plugins/ModelTVVideoPlugin/index.js +4 -2
- package/plugins/ModelViewPlugin/index.js +2 -2
- package/plugins/PanoCursorRaycasterPlugin/index.js +2 -0
- package/plugins/PanoMaskSelectorPlugin/createBox.js +3 -0
- package/plugins/PanoMaskSelectorPlugin/index.js +3 -1
- package/plugins/PanoMeasurePlugin/Controller/BaseController.d.ts +36 -0
- package/plugins/PanoMeasurePlugin/Controller/BaseController.js +105 -0
- package/plugins/PanoMeasurePlugin/Controller/EditController.d.ts +52 -0
- package/plugins/PanoMeasurePlugin/Controller/EditController.js +343 -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 +373 -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 +237 -0
- package/plugins/PanoMeasurePlugin/Model/line.d.ts +30 -0
- package/plugins/PanoMeasurePlugin/Model/line.js +123 -0
- package/plugins/PanoMeasurePlugin/Model/point.d.ts +16 -0
- package/plugins/PanoMeasurePlugin/Model/point.js +72 -0
- package/plugins/PanoMeasurePlugin/Model/polyline.d.ts +16 -0
- package/plugins/PanoMeasurePlugin/Model/polyline.js +111 -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 +184 -0
- package/plugins/PanoMeasurePlugin/Modules/FiveHelper.d.ts +11 -0
- package/plugins/PanoMeasurePlugin/Modules/FiveHelper.js +68 -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 +125 -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 +39 -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 +8 -3
- package/plugins/PanoTVVideoPlugin/index.d.ts +2 -0
- package/plugins/PanoTVVideoPlugin/index.js +20 -14
- package/plugins/TreasurePlugin/Controller.js +2 -2
- package/plugins/TreasurePlugin/TreasureOpenAnime.js +2 -2
- package/plugins/floorplan/Assets/floorplanExtraObject.d.ts +1 -1
- package/plugins/floorplan/Assets/floorplanExtraObject.js +3 -3
- 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/RoomHighlight.js +2 -2
- 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 +182 -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/ModelFloorplanPlugin/utils/correctFiveState.js +1 -1
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.js +3 -2
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.style.js +4 -4
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/ExtraObjects.js +2 -2
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/RoomHighlight.js +2 -2
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/index.js +2 -2
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.js +2 -2
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Controller.d.ts +1 -1
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Controller.js +3 -3
- package/plugins/floorplan/TopviewFloorplanPlugin/Controller.d.ts +3 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/Controller.js +16 -6
- 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 +3 -1
- package/plugins/floorplan/typings/floorplanServerData.js +3 -3
- package/plugins/floorplan/utils/formatData.js +3 -2
- package/plugins/floorplan/utils/formatPosition.js +2 -0
- package/shared-utils/Subscribe.js +4 -2
- package/shared-utils/animationFrame/BetterTween.js +5 -1
- package/shared-utils/changeModelCanvasOpacity.d.ts +2 -0
- package/shared-utils/{changeModelCanvansOpacity.js → changeModelCanvasOpacity.js} +2 -2
- package/shared-utils/filter.js +4 -2
- package/shared-utils/math/evenNumber.d.ts +3 -1
- package/shared-utils/math/evenNumber.js +4 -2
- package/shared-utils/math/planimetry.js +2 -0
- 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/typedoc/libs.d.ts +1 -0
- package/typedoc/libs.js +7 -0
- package/components/PBRView/index.d.ts +0 -14
- package/shared-utils/changeModelCanvansOpacity.d.ts +0 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.object.to-string.js");
|
|
4
|
+
|
|
3
5
|
require("core-js/modules/es.reflect.construct.js");
|
|
4
6
|
|
|
5
7
|
require("core-js/modules/es.array.iterator.js");
|
|
6
8
|
|
|
7
|
-
require("core-js/modules/es.object.to-string.js");
|
|
8
|
-
|
|
9
9
|
require("core-js/modules/es.string.iterator.js");
|
|
10
10
|
|
|
11
11
|
require("core-js/modules/es.weak-map.js");
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { GLTFViewer, GLTFViewerConfig } from '../../libs/gltf-viewer';
|
|
3
|
+
export declare type GLTFViewPropTypes = {
|
|
4
|
+
url: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
refs?: (gltfViewer: GLTFViewer) => void;
|
|
7
|
+
} & GLTFViewerConfig;
|
|
8
|
+
/**
|
|
9
|
+
* **GLTFViewer** 预览 `glTF` 模型文件(支持 `.gltf` 和 `.glb` 格式),附带光照等效果等配置。
|
|
10
|
+
*
|
|
11
|
+
* ### Usage
|
|
12
|
+
*
|
|
13
|
+
* 基础用法:
|
|
14
|
+
*
|
|
15
|
+
* ```jsx
|
|
16
|
+
* import { GLTFViewer } from '@realsee/dnalogel/libs/gltf-viewer'
|
|
17
|
+
*
|
|
18
|
+
* // 创建实例
|
|
19
|
+
* const gltfViewer = new GLTFViewer({
|
|
20
|
+
* pixelRatio: 1,
|
|
21
|
+
* })
|
|
22
|
+
*
|
|
23
|
+
* // 挂载至 DOM 节点
|
|
24
|
+
* gltfViewer.appendTo(ref.current)
|
|
25
|
+
*
|
|
26
|
+
* // 加载模型文件
|
|
27
|
+
* await gltfViewer.load(glbCDNUrl)
|
|
28
|
+
*
|
|
29
|
+
* // 输出当前模型状态数据
|
|
30
|
+
* console.log(gltfViewer.state)
|
|
31
|
+
* // { longitude: 0, latitude: -0.3, fov: 35 }
|
|
32
|
+
*
|
|
33
|
+
* // 设置当前模型状态:直接给状态对象赋值(立即生效)
|
|
34
|
+
* gltfViewer.state = { longitude: 0, latitude: -0.3, fov: 35 }
|
|
35
|
+
*
|
|
36
|
+
* // 设置当前模型状态:直接给状态对象单个属性赋值(立即生效)
|
|
37
|
+
* gltfViewer.state.fov = 50
|
|
38
|
+
*
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* 事件监听:
|
|
42
|
+
*
|
|
43
|
+
* ```jsx
|
|
44
|
+
* gltfViewer.on('stateChange', (state: GLTFViewerState) => {
|
|
45
|
+
* // 事件:模型状态变化
|
|
46
|
+
* })
|
|
47
|
+
* gltfViewer.on('willLoad', () => {
|
|
48
|
+
* // 即将加载
|
|
49
|
+
* })
|
|
50
|
+
* gltfViewer.on('progressing', (progressing: number) => {
|
|
51
|
+
* // 加载进度
|
|
52
|
+
* })
|
|
53
|
+
* gltfViewer.on('loaded', (gltf: GLTF) => {
|
|
54
|
+
* // 加载完成
|
|
55
|
+
* })
|
|
56
|
+
* gltfViewer.on('loadError', (error) => {
|
|
57
|
+
* // 加载异常
|
|
58
|
+
* })
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* React 组件:
|
|
62
|
+
*
|
|
63
|
+
* ```jsx
|
|
64
|
+
* import { GLTFView } from '@realsee/dnalogel/components/GLTFView'
|
|
65
|
+
*
|
|
66
|
+
* <GLTFView
|
|
67
|
+
* url="//vrlab-static.ljcdn.com/release/web/demo.435f5fa2.glb"
|
|
68
|
+
* ref={(gltfViewer) => gltfViewer.on('stateChange', (state) => console.log(state))} />
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* ### 动画
|
|
72
|
+
*
|
|
73
|
+
* `GLTFViewer` 默认不提供动画实现,但是你可以配合 [TWEEN.js](http://tweenjs.github.io/tween.js/docs/user_guide.html) 通过修改 `state` 来得到你想要的动画效果,比如:
|
|
74
|
+
*
|
|
75
|
+
* ```jsx
|
|
76
|
+
* import TWEEN from '@tweenjs/tween.js'
|
|
77
|
+
*
|
|
78
|
+
* function animate(time: number) {
|
|
79
|
+
* requestAnimationFrame(animate)
|
|
80
|
+
* TWEEN.update(time)
|
|
81
|
+
* }
|
|
82
|
+
*
|
|
83
|
+
* requestAnimationFrame(animate)
|
|
84
|
+
*
|
|
85
|
+
* const tween = new TWEEN.Tween({ fov: 35, longitude: 0, latitude: -0.3 })
|
|
86
|
+
* .to({fov: 60, latitude: -1.1496852156837822, longitude: 2.4468501085409855 }, 2000 )
|
|
87
|
+
* .easing(TWEEN.Easing.Quadratic.Out)
|
|
88
|
+
* .onUpdate((newState) => gltfViewer.state = newState)
|
|
89
|
+
* .start()
|
|
90
|
+
*
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* ### 光照配置
|
|
94
|
+
*
|
|
95
|
+
* ```ts
|
|
96
|
+
* pointLight?: THREE.PointLight | false
|
|
97
|
+
* directionalLight?: THREE.DirectionalLight | false
|
|
98
|
+
* ambientLight?: THREE.AmbientLight | false
|
|
99
|
+
* // 色调映射
|
|
100
|
+
* toneMapping?: {
|
|
101
|
+
* toneMapping?: THREE.ToneMapping
|
|
102
|
+
* toneMappingExposure?: number
|
|
103
|
+
* }
|
|
104
|
+
*
|
|
105
|
+
* ```
|
|
106
|
+
* 自带三种默认光照配置,你可以提供自己的光照实例。如果设置 `pointLight: false` 则禁用该光照效果。
|
|
107
|
+
*
|
|
108
|
+
* ### 更多自定义
|
|
109
|
+
*
|
|
110
|
+
* 你可以监听模型加载完 `loaded` 事件,回调函数会提供 `scene`、`renderer` 实例,可以进行更多自定义设置。
|
|
111
|
+
*
|
|
112
|
+
* ```ts
|
|
113
|
+
* gltfViewer.once('loaded', (gltf, scene, renderer) => {
|
|
114
|
+
* // 获取 renderer 实例,进行相关配置
|
|
115
|
+
* renderer.localClippingEnabled = true
|
|
116
|
+
* // 刷新:重新渲染
|
|
117
|
+
* gltfViewer.refresh()
|
|
118
|
+
* })
|
|
119
|
+
* ```
|
|
120
|
+
*
|
|
121
|
+
*/
|
|
122
|
+
export declare const GLTFView: React.FC<GLTFViewPropTypes>;
|
|
123
|
+
export default GLTFView;
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.array.iterator.js");
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.object.to-string.js");
|
|
6
|
+
|
|
7
|
+
require("core-js/modules/es.string.iterator.js");
|
|
8
|
+
|
|
9
|
+
require("core-js/modules/es.weak-map.js");
|
|
10
|
+
|
|
11
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
12
|
+
|
|
13
|
+
require("core-js/modules/es.object.define-property.js");
|
|
14
|
+
|
|
15
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
16
|
+
|
|
17
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
18
|
+
|
|
19
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
20
|
+
|
|
21
|
+
Object.defineProperty(exports, "__esModule", {
|
|
22
|
+
value: true
|
|
23
|
+
});
|
|
24
|
+
exports["default"] = exports.GLTFView = void 0;
|
|
25
|
+
|
|
26
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
27
|
+
|
|
28
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
29
|
+
|
|
30
|
+
var React = _interopRequireWildcard(require("react"));
|
|
31
|
+
|
|
32
|
+
var _gltfViewer = require("../../libs/gltf-viewer");
|
|
33
|
+
|
|
34
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
35
|
+
|
|
36
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* **GLTFViewer** 预览 `glTF` 模型文件(支持 `.gltf` 和 `.glb` 格式),附带光照等效果等配置。
|
|
40
|
+
*
|
|
41
|
+
* ### Usage
|
|
42
|
+
*
|
|
43
|
+
* 基础用法:
|
|
44
|
+
*
|
|
45
|
+
* ```jsx
|
|
46
|
+
* import { GLTFViewer } from '@realsee/dnalogel/libs/gltf-viewer'
|
|
47
|
+
*
|
|
48
|
+
* // 创建实例
|
|
49
|
+
* const gltfViewer = new GLTFViewer({
|
|
50
|
+
* pixelRatio: 1,
|
|
51
|
+
* })
|
|
52
|
+
*
|
|
53
|
+
* // 挂载至 DOM 节点
|
|
54
|
+
* gltfViewer.appendTo(ref.current)
|
|
55
|
+
*
|
|
56
|
+
* // 加载模型文件
|
|
57
|
+
* await gltfViewer.load(glbCDNUrl)
|
|
58
|
+
*
|
|
59
|
+
* // 输出当前模型状态数据
|
|
60
|
+
* console.log(gltfViewer.state)
|
|
61
|
+
* // { longitude: 0, latitude: -0.3, fov: 35 }
|
|
62
|
+
*
|
|
63
|
+
* // 设置当前模型状态:直接给状态对象赋值(立即生效)
|
|
64
|
+
* gltfViewer.state = { longitude: 0, latitude: -0.3, fov: 35 }
|
|
65
|
+
*
|
|
66
|
+
* // 设置当前模型状态:直接给状态对象单个属性赋值(立即生效)
|
|
67
|
+
* gltfViewer.state.fov = 50
|
|
68
|
+
*
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* 事件监听:
|
|
72
|
+
*
|
|
73
|
+
* ```jsx
|
|
74
|
+
* gltfViewer.on('stateChange', (state: GLTFViewerState) => {
|
|
75
|
+
* // 事件:模型状态变化
|
|
76
|
+
* })
|
|
77
|
+
* gltfViewer.on('willLoad', () => {
|
|
78
|
+
* // 即将加载
|
|
79
|
+
* })
|
|
80
|
+
* gltfViewer.on('progressing', (progressing: number) => {
|
|
81
|
+
* // 加载进度
|
|
82
|
+
* })
|
|
83
|
+
* gltfViewer.on('loaded', (gltf: GLTF) => {
|
|
84
|
+
* // 加载完成
|
|
85
|
+
* })
|
|
86
|
+
* gltfViewer.on('loadError', (error) => {
|
|
87
|
+
* // 加载异常
|
|
88
|
+
* })
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* React 组件:
|
|
92
|
+
*
|
|
93
|
+
* ```jsx
|
|
94
|
+
* import { GLTFView } from '@realsee/dnalogel/components/GLTFView'
|
|
95
|
+
*
|
|
96
|
+
* <GLTFView
|
|
97
|
+
* url="//vrlab-static.ljcdn.com/release/web/demo.435f5fa2.glb"
|
|
98
|
+
* ref={(gltfViewer) => gltfViewer.on('stateChange', (state) => console.log(state))} />
|
|
99
|
+
* ```
|
|
100
|
+
*
|
|
101
|
+
* ### 动画
|
|
102
|
+
*
|
|
103
|
+
* `GLTFViewer` 默认不提供动画实现,但是你可以配合 [TWEEN.js](http://tweenjs.github.io/tween.js/docs/user_guide.html) 通过修改 `state` 来得到你想要的动画效果,比如:
|
|
104
|
+
*
|
|
105
|
+
* ```jsx
|
|
106
|
+
* import TWEEN from '@tweenjs/tween.js'
|
|
107
|
+
*
|
|
108
|
+
* function animate(time: number) {
|
|
109
|
+
* requestAnimationFrame(animate)
|
|
110
|
+
* TWEEN.update(time)
|
|
111
|
+
* }
|
|
112
|
+
*
|
|
113
|
+
* requestAnimationFrame(animate)
|
|
114
|
+
*
|
|
115
|
+
* const tween = new TWEEN.Tween({ fov: 35, longitude: 0, latitude: -0.3 })
|
|
116
|
+
* .to({fov: 60, latitude: -1.1496852156837822, longitude: 2.4468501085409855 }, 2000 )
|
|
117
|
+
* .easing(TWEEN.Easing.Quadratic.Out)
|
|
118
|
+
* .onUpdate((newState) => gltfViewer.state = newState)
|
|
119
|
+
* .start()
|
|
120
|
+
*
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
123
|
+
* ### 光照配置
|
|
124
|
+
*
|
|
125
|
+
* ```ts
|
|
126
|
+
* pointLight?: THREE.PointLight | false
|
|
127
|
+
* directionalLight?: THREE.DirectionalLight | false
|
|
128
|
+
* ambientLight?: THREE.AmbientLight | false
|
|
129
|
+
* // 色调映射
|
|
130
|
+
* toneMapping?: {
|
|
131
|
+
* toneMapping?: THREE.ToneMapping
|
|
132
|
+
* toneMappingExposure?: number
|
|
133
|
+
* }
|
|
134
|
+
*
|
|
135
|
+
* ```
|
|
136
|
+
* 自带三种默认光照配置,你可以提供自己的光照实例。如果设置 `pointLight: false` 则禁用该光照效果。
|
|
137
|
+
*
|
|
138
|
+
* ### 更多自定义
|
|
139
|
+
*
|
|
140
|
+
* 你可以监听模型加载完 `loaded` 事件,回调函数会提供 `scene`、`renderer` 实例,可以进行更多自定义设置。
|
|
141
|
+
*
|
|
142
|
+
* ```ts
|
|
143
|
+
* gltfViewer.once('loaded', (gltf, scene, renderer) => {
|
|
144
|
+
* // 获取 renderer 实例,进行相关配置
|
|
145
|
+
* renderer.localClippingEnabled = true
|
|
146
|
+
* // 刷新:重新渲染
|
|
147
|
+
* gltfViewer.refresh()
|
|
148
|
+
* })
|
|
149
|
+
* ```
|
|
150
|
+
*
|
|
151
|
+
*/
|
|
152
|
+
var GLTFView = function GLTFView(props) {
|
|
153
|
+
var ref = React.useRef(null);
|
|
154
|
+
React.useEffect(function () {
|
|
155
|
+
if (!ref.current) return;
|
|
156
|
+
var gltfViewer = new _gltfViewer.GLTFViewer(props);
|
|
157
|
+
gltfViewer.appendTo(ref.current);
|
|
158
|
+
gltfViewer.once('loaded', function (gltf, scene, renderer) {
|
|
159
|
+
renderer.capabilities.logarithmicDepthBuffer = true;
|
|
160
|
+
gltfViewer.refresh();
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
var callback = /*#__PURE__*/function () {
|
|
164
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
165
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
166
|
+
while (1) {
|
|
167
|
+
switch (_context.prev = _context.next) {
|
|
168
|
+
case 0:
|
|
169
|
+
_context.next = 2;
|
|
170
|
+
return gltfViewer.load(props.url);
|
|
171
|
+
|
|
172
|
+
case 2:
|
|
173
|
+
case "end":
|
|
174
|
+
return _context.stop();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}, _callee);
|
|
178
|
+
}));
|
|
179
|
+
|
|
180
|
+
return function callback() {
|
|
181
|
+
return _ref.apply(this, arguments);
|
|
182
|
+
};
|
|
183
|
+
}();
|
|
184
|
+
|
|
185
|
+
callback(); // 实例
|
|
186
|
+
|
|
187
|
+
if (props.refs) {
|
|
188
|
+
props.refs(gltfViewer);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return function () {
|
|
192
|
+
gltfViewer.dispose();
|
|
193
|
+
};
|
|
194
|
+
}, []);
|
|
195
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
196
|
+
className: 'GLTFView ' + (props.className || ''),
|
|
197
|
+
ref: ref
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
exports.GLTFView = GLTFView;
|
|
202
|
+
GLTFView.defaultProps = {};
|
|
203
|
+
var _default = GLTFView;
|
|
204
|
+
exports["default"] = _default;
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.array.iterator.js");
|
|
4
4
|
|
|
5
|
-
require("core-js/modules/es.object.to-string.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.string.iterator.js");
|
|
8
6
|
|
|
9
7
|
require("core-js/modules/es.weak-map.js");
|
|
@@ -24,6 +22,8 @@ exports["default"] = void 0;
|
|
|
24
22
|
|
|
25
23
|
require("core-js/modules/es.array.reduce.js");
|
|
26
24
|
|
|
25
|
+
require("core-js/modules/es.object.to-string.js");
|
|
26
|
+
|
|
27
27
|
require("core-js/modules/es.array.filter.js");
|
|
28
28
|
|
|
29
29
|
require("core-js/modules/es.object.keys.js");
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.array.iterator.js");
|
|
4
4
|
|
|
5
|
-
require("core-js/modules/es.object.to-string.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.string.iterator.js");
|
|
8
6
|
|
|
9
7
|
require("core-js/modules/es.weak-map.js");
|
|
@@ -27,8 +25,12 @@ require("core-js/modules/es.array.concat.js");
|
|
|
27
25
|
|
|
28
26
|
require("core-js/modules/es.array.for-each.js");
|
|
29
27
|
|
|
28
|
+
require("core-js/modules/es.object.to-string.js");
|
|
29
|
+
|
|
30
30
|
require("core-js/modules/web.dom-collections.for-each.js");
|
|
31
31
|
|
|
32
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
33
|
+
|
|
32
34
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
33
35
|
|
|
34
36
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
@@ -39,7 +41,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
39
41
|
|
|
40
42
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
41
43
|
|
|
42
|
-
var ModelViewController = function ModelViewController() {
|
|
44
|
+
var ModelViewController = /*#__PURE__*/(0, _createClass2["default"])(function ModelViewController() {
|
|
43
45
|
var _this = this;
|
|
44
46
|
|
|
45
47
|
(0, _classCallCheck2["default"])(this, ModelViewController);
|
|
@@ -152,6 +154,5 @@ var ModelViewController = function ModelViewController() {
|
|
|
152
154
|
this.scene.add(_light2);
|
|
153
155
|
}
|
|
154
156
|
this.scene.add(this.model);
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
+
});
|
|
157
158
|
exports["default"] = ModelViewController;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export declare const work: {
|
|
2
|
+
_signature: string;
|
|
3
|
+
allow_hosts: string[];
|
|
4
|
+
base_url: string;
|
|
5
|
+
certificate: string;
|
|
6
|
+
create_time: null;
|
|
7
|
+
expire_at: string;
|
|
8
|
+
initial: {
|
|
9
|
+
fov: number;
|
|
10
|
+
latitude: number;
|
|
11
|
+
longitude: number;
|
|
12
|
+
pano_index: number;
|
|
13
|
+
recordVideo: boolean;
|
|
14
|
+
};
|
|
15
|
+
model: {
|
|
16
|
+
file_url: string;
|
|
17
|
+
material_base_url: string;
|
|
18
|
+
material_textures: string[];
|
|
19
|
+
};
|
|
20
|
+
observers: {
|
|
21
|
+
accessible_nodes: number[];
|
|
22
|
+
create_time: string;
|
|
23
|
+
floor_index: number;
|
|
24
|
+
id: number;
|
|
25
|
+
index: number;
|
|
26
|
+
position: number[];
|
|
27
|
+
quaternion: {
|
|
28
|
+
w: number;
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
z: number;
|
|
32
|
+
};
|
|
33
|
+
standing_position: number[];
|
|
34
|
+
visible_nodes: number[];
|
|
35
|
+
}[];
|
|
36
|
+
panorama: {
|
|
37
|
+
count: number;
|
|
38
|
+
list: {
|
|
39
|
+
back: string;
|
|
40
|
+
down: string;
|
|
41
|
+
front: string;
|
|
42
|
+
index: number;
|
|
43
|
+
left: string;
|
|
44
|
+
right: string;
|
|
45
|
+
up: string;
|
|
46
|
+
}[];
|
|
47
|
+
};
|
|
48
|
+
picture_url: string;
|
|
49
|
+
};
|