@realsee/dnalogel 0.1.3 → 0.1.7-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ARVideoFigure/ARVideoFigureMesh.js +56 -32
- package/components/ARVideoFigure/ARVideoFigureScene.js +30 -19
- package/components/ARVideoFigure/ImgBgTransparent.js +22 -6
- package/components/ARVideoFigure/ImgBgTransparentMesh.js +40 -30
- package/components/ARVideoFigure/fragmentShader.js +2 -0
- package/components/ARVideoFigure/index.js +22 -6
- package/components/ARVideoFigure/vertexShader.js +2 -0
- package/components/GLTFView/index.d.ts +104 -0
- package/components/GLTFView/index.js +181 -0
- package/components/GlassFilters/index.js +25 -1
- package/components/ModelView/ModelViewController.js +39 -29
- package/components/ModelView/index.js +4 -2
- package/components/PaintBrush/index.js +15 -1
- package/components/PanoTag/index.js +2 -0
- package/data/1aGKl9JmrlXMXx8d.js +2 -0
- package/data/54djM0oR6ky3Ey8e.d.ts +55 -0
- package/data/54djM0oR6ky3Ey8e.js +350 -0
- package/data/6gyq3v1verxD7JO1.js +2 -0
- package/data/8054djM0oR6ky3Ey8e.d.ts +55 -0
- package/data/8054djM0oR6ky3Ey8e.js +350 -0
- package/data/KpokNd82rwjhackhQTBEoYKHg8zGbPXe.js +2 -0
- package/data/PrXel3aqGbp34JQn.js +2 -0
- package/data/XJ6NMLWnkAY3Rdx8.js +2 -0
- package/data/YdoNP9K4rwQDwjJr.js +2 -0
- package/data/ZLvK29zj4L29Jowd.d.ts +55 -0
- package/data/ZLvK29zj4L29Jowd.js +372 -0
- package/data/auto3d-njL5J99VwCmnjtQElOmXQr.js +2 -0
- package/data/extrude-walls/ZLvK29zj4L29Jowd.d.ts +5 -0
- package/data/extrude-walls/ZLvK29zj4L29Jowd.js +14 -0
- package/data/extrude-walls/lo024DEgzanMj5BE.d.ts +5 -0
- package/data/extrude-walls/lo024DEgzanMj5BE.js +14 -0
- package/data/jd6oMOzPxnQ3BvxY_B7yw51J9rXlhYhjhGTOgRVqu6WeEqjNX.js +2 -0
- package/data/lo024DEgzanMj5BE.d.ts +55 -0
- package/data/lo024DEgzanMj5BE.js +966 -0
- package/data/oPzy3ApbjjpD8YdR.js +2 -0
- package/data/qjAxMG4XbPn96wKG.js +2 -0
- package/data/rXel3aPQRRBD4JQn.js +2 -0
- package/data/vLykj3NWrllMrG06.js +2 -0
- package/data/wz0QV9KA4ugyo9ME.js +2 -0
- package/data/zxMawr9raSg8LYjG.js +2 -0
- package/examples/FiveStateController/index.js +9 -15
- package/examples/VRHouse/Mobile.js +15 -1
- package/examples/VRHouse/PC.js +15 -1
- package/examples/VRHouse/index.js +15 -1
- package/index.js +4 -2
- package/libs/gltf-viewer/Subscribe.d.ts +76 -0
- package/libs/gltf-viewer/Subscribe.js +231 -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} +29 -19
- 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 +60 -0
- package/libs/gltf-viewer/index.js +672 -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 +7 -3
- package/plugins/AutoPreloadPlugin/index.js +26 -0
- package/plugins/CSS3DRenderPlugin/components/Marker/index.js +24 -16
- package/plugins/CSS3DRenderPlugin/index.js +31 -3
- package/plugins/CameraMovementPlugin/index.js +33 -9
- package/plugins/CameraMovementPlugin/typing.js +2 -0
- package/plugins/ModelChassisCompassPlugin/index.js +23 -9
- package/plugins/ModelEntryDoorGuidePlugin/index.d.ts +2 -2
- package/plugins/ModelEntryDoorGuidePlugin/index.js +43 -22
- package/plugins/ModelExtrudeWallsPlugin/index.d.ts +16 -0
- package/plugins/ModelExtrudeWallsPlugin/index.js +252 -0
- package/plugins/ModelRoomLabelPlugin/Controller.js +29 -23
- package/plugins/ModelRoomLabelPlugin/RoomLabelItem.js +21 -3
- package/plugins/ModelRoomLabelPlugin/RoomLabelItems.js +35 -25
- package/plugins/ModelRoomLabelPlugin/index.js +2 -0
- package/plugins/ModelRoomLabelPlugin/typings.js +2 -0
- package/plugins/ModelRoomLabelPlugin/utils/parseData.js +6 -0
- package/plugins/ModelTVVideoPlugin/index.js +100 -16
- package/plugins/ModelViewPlugin/index.js +25 -1
- package/plugins/PanoCursorRaycasterPlugin/components/MovePointTowardsCamera.js +29 -25
- package/plugins/PanoCursorRaycasterPlugin/components/PointAxesHelper.js +15 -1
- package/plugins/PanoCursorRaycasterPlugin/index.js +13 -6
- package/plugins/PanoCursorRaycasterPlugin/utils/addLineToFive.js +4 -2
- package/plugins/PanoCursorRaycasterPlugin/utils/createLine.js +15 -1
- package/plugins/PanoDoorLabelPlugin/index.js +2 -0
- package/plugins/PanoIRobotPlugin/index.js +2 -0
- package/plugins/PanoMaskSelectorPlugin/compare.js +2 -0
- package/plugins/PanoMaskSelectorPlugin/createBox.js +22 -1
- package/plugins/PanoMaskSelectorPlugin/createTextures.js +17 -1
- package/plugins/PanoMaskSelectorPlugin/fragmentShader.js +2 -0
- package/plugins/PanoMaskSelectorPlugin/index.js +106 -18
- package/plugins/PanoMaskSelectorPlugin/vertexShader.js +2 -0
- package/plugins/PanoRulerPlugin/data/roomInfo.js +2 -0
- package/plugins/PanoRulerPlugin/data/roomRules.js +2 -0
- package/plugins/PanoRulerPlugin/index.js +68 -20
- package/plugins/PanoRulerPlugin/typings.js +2 -0
- package/plugins/PanoTVVideoPlugin/index.d.ts +2 -0
- package/plugins/PanoTVVideoPlugin/index.js +108 -26
- package/plugins/TreasurePlugin/Controller.js +58 -52
- package/plugins/TreasurePlugin/TreasureFaceAnime.js +36 -21
- package/plugins/TreasurePlugin/TreasureObject.js +60 -56
- package/plugins/TreasurePlugin/TreasureOpenAnime.js +38 -19
- package/plugins/TreasurePlugin/constants.js +2 -0
- package/plugins/TreasurePlugin/index.js +2 -0
- package/plugins/TreasurePlugin/typings.js +2 -0
- package/plugins/floorplan/Assets/floorplanExtraObject.js +2 -0
- package/plugins/floorplan/ModelFloorplanPlugin/Controller.js +71 -88
- package/plugins/floorplan/ModelFloorplanPlugin/components/Camera.js +21 -3
- package/plugins/floorplan/ModelFloorplanPlugin/components/Compass.js +17 -3
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomHighlight.js +28 -4
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomLabels.js +23 -3
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/index.js +20 -6
- package/plugins/floorplan/ModelFloorplanPlugin/components/index.js +29 -7
- package/plugins/floorplan/ModelFloorplanPlugin/controller.style.js +2 -0
- package/plugins/floorplan/ModelFloorplanPlugin/index.js +4 -2
- package/plugins/floorplan/ModelFloorplanPlugin/typings/events.type.js +2 -0
- package/plugins/floorplan/ModelFloorplanPlugin/utils/constant.js +2 -0
- package/plugins/floorplan/ModelFloorplanPlugin/utils/correctFiveState.js +14 -22
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.js +25 -3
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.style.js +6 -2
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/ExtraObjects.js +19 -3
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/RoomHighlight.js +28 -4
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/index.js +22 -6
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.js +29 -19
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.style.js +2 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Controller.js +44 -47
- package/plugins/floorplan/PanoFloorplanRadarPlugin/index.js +4 -2
- package/plugins/floorplan/TopviewFloorplanPlugin/Controller.js +50 -55
- package/plugins/floorplan/TopviewFloorplanPlugin/index.js +2 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/style.js +2 -0
- package/plugins/floorplan/components/FloorplanImage.js +15 -1
- package/plugins/floorplan/typings/floorplanData.js +2 -0
- package/plugins/floorplan/typings/floorplanServerData.js +2 -0
- package/plugins/floorplan/utils/formatData.js +28 -10
- package/plugins/floorplan/utils/formatPosition.js +10 -8
- package/shared-utils/Preloader.js +6 -0
- package/shared-utils/Subscribe.js +36 -16
- package/shared-utils/animationFrame/BetterTween.js +28 -27
- package/shared-utils/animationFrame/calculateProgress.js +2 -0
- package/shared-utils/animationFrame/formatRad.js +2 -0
- package/shared-utils/animationFrame/index.js +12 -0
- package/shared-utils/animationFrame/tween.js +17 -1
- package/shared-utils/changeModelCanvansOpacity.js +14 -0
- package/shared-utils/createCanvasTextTexture.js +2 -0
- package/shared-utils/createFiveContainer.js +23 -17
- package/shared-utils/createLine/index.js +15 -1
- package/shared-utils/debounce.js +4 -0
- package/shared-utils/equal.js +15 -4
- package/shared-utils/filter.js +36 -2
- package/shared-utils/five/changeMode.js +13 -17
- package/shared-utils/five/useFivePlugin.js +2 -0
- package/shared-utils/formatRad.js +2 -0
- package/shared-utils/getPxmm.js +15 -1
- package/shared-utils/getRandomColor.js +10 -0
- package/shared-utils/isNil.js +2 -0
- package/shared-utils/isTruelyObject.js +4 -0
- package/shared-utils/math/evenNumber.js +2 -0
- package/shared-utils/math/planimetry.js +10 -0
- package/shared-utils/math/rad2Deg.js +2 -0
- package/shared-utils/nearlyEqual.js +2 -0
- package/shared-utils/nextFrame.js +2 -0
- package/shared-utils/noop.js +2 -0
- package/shared-utils/object3d2LocalMatrix.js +20 -14
- package/shared-utils/px2rem.js +10 -0
- package/shared-utils/tap.js +2 -0
- package/shared-utils/three/centerPoint.js +2 -0
- package/shared-utils/three/getExtraModelLoader.js +14 -0
- package/shared-utils/three/getNormal.js +4 -0
- package/shared-utils/three/getTextureLoader.js +16 -0
- package/shared-utils/three/loadFbxObj.js +13 -5
- package/shared-utils/three/loadTexture.js +13 -5
- package/shared-utils/three/transformPositionToVector3.js +2 -0
- package/shared-utils/three/transfromToMeshBasicMaterial.js +6 -0
- package/shared-utils/throttle.js +4 -0
- package/shared-utils/to.js +8 -4
- package/shared-utils/useDebounce.js +6 -0
- package/shared-utils/useThrottle.js +6 -0
- package/shared-utils/uuid.js +8 -0
- package/shared-utils/vectorTocoordinates.js +2 -0
- package/typedoc/components.js +2 -0
- package/typedoc/libs.d.ts +1 -0
- package/typedoc/libs.js +7 -0
- package/typedoc/plugins.js +2 -0
- package/typedoc/shared-utils.js +2 -0
- package/typedoc/typings.js +2 -0
- package/typings/math.type.js +2 -0
- package/typings/utils.type.js +2 -0
- package/components/PBRView/index.d.ts +0 -14
|
@@ -0,0 +1,104 @@
|
|
|
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
|
+
* 自带三种默认光照配置,你可以提供自己的光照实例。如果设置 `pointLight: false` 则禁用该光照效果。
|
|
101
|
+
*
|
|
102
|
+
*/
|
|
103
|
+
export declare const GLTFView: React.FC<GLTFViewPropTypes>;
|
|
104
|
+
export default GLTFView;
|
|
@@ -0,0 +1,181 @@
|
|
|
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
|
+
* 自带三种默认光照配置,你可以提供自己的光照实例。如果设置 `pointLight: false` 则禁用该光照效果。
|
|
131
|
+
*
|
|
132
|
+
*/
|
|
133
|
+
var GLTFView = function GLTFView(props) {
|
|
134
|
+
var ref = React.useRef(null);
|
|
135
|
+
React.useEffect(function () {
|
|
136
|
+
if (!ref.current) return;
|
|
137
|
+
var gltfViewer = new _gltfViewer.GLTFViewer(props);
|
|
138
|
+
gltfViewer.appendTo(ref.current);
|
|
139
|
+
|
|
140
|
+
var callback = /*#__PURE__*/function () {
|
|
141
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
142
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
143
|
+
while (1) {
|
|
144
|
+
switch (_context.prev = _context.next) {
|
|
145
|
+
case 0:
|
|
146
|
+
_context.next = 2;
|
|
147
|
+
return gltfViewer.load(props.url);
|
|
148
|
+
|
|
149
|
+
case 2:
|
|
150
|
+
case "end":
|
|
151
|
+
return _context.stop();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}, _callee);
|
|
155
|
+
}));
|
|
156
|
+
|
|
157
|
+
return function callback() {
|
|
158
|
+
return _ref.apply(this, arguments);
|
|
159
|
+
};
|
|
160
|
+
}();
|
|
161
|
+
|
|
162
|
+
callback(); // 实例
|
|
163
|
+
|
|
164
|
+
if (props.refs) {
|
|
165
|
+
props.refs(gltfViewer);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return function () {
|
|
169
|
+
gltfViewer.dispose();
|
|
170
|
+
};
|
|
171
|
+
}, []);
|
|
172
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
173
|
+
className: 'GLTFView ' + (props.className || ''),
|
|
174
|
+
ref: ref
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
exports.GLTFView = GLTFView;
|
|
179
|
+
GLTFView.defaultProps = {};
|
|
180
|
+
var _default = GLTFView;
|
|
181
|
+
exports["default"] = _default;
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
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 _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
18
|
|
|
5
19
|
Object.defineProperty(exports, "__esModule", {
|
|
6
20
|
value: true
|
|
@@ -8,6 +22,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
22
|
exports.GlassFilters = GlassFilters;
|
|
9
23
|
exports["default"] = void 0;
|
|
10
24
|
|
|
25
|
+
require("core-js/modules/es.array.reduce.js");
|
|
26
|
+
|
|
27
|
+
require("core-js/modules/es.array.filter.js");
|
|
28
|
+
|
|
29
|
+
require("core-js/modules/es.object.keys.js");
|
|
30
|
+
|
|
31
|
+
require("core-js/modules/es.array.includes.js");
|
|
32
|
+
|
|
33
|
+
require("core-js/modules/es.array.concat.js");
|
|
34
|
+
|
|
11
35
|
var React = _interopRequireWildcard(require("react"));
|
|
12
36
|
|
|
13
37
|
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); }
|
|
@@ -1,38 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
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");
|
|
4
20
|
|
|
5
21
|
Object.defineProperty(exports, "__esModule", {
|
|
6
22
|
value: true
|
|
7
23
|
});
|
|
8
24
|
exports["default"] = void 0;
|
|
9
25
|
|
|
10
|
-
|
|
26
|
+
require("core-js/modules/es.array.concat.js");
|
|
11
27
|
|
|
12
|
-
|
|
28
|
+
require("core-js/modules/es.array.for-each.js");
|
|
13
29
|
|
|
14
|
-
|
|
30
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
15
31
|
|
|
16
|
-
|
|
32
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
33
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var ModelViewController = function ModelViewController() {
|
|
21
|
-
var _this = this;
|
|
34
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
22
35
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
_defineProperty(this, "needsRender", true);
|
|
26
|
-
|
|
27
|
-
_defineProperty(this, "scene", new THREE.Scene());
|
|
36
|
+
var THREE = _interopRequireWildcard(require("three"));
|
|
28
37
|
|
|
29
|
-
|
|
38
|
+
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); }
|
|
30
39
|
|
|
31
|
-
|
|
40
|
+
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; }
|
|
32
41
|
|
|
33
|
-
|
|
42
|
+
var ModelViewController = function ModelViewController() {
|
|
43
|
+
var _this = this;
|
|
34
44
|
|
|
35
|
-
|
|
45
|
+
(0, _classCallCheck2["default"])(this, ModelViewController);
|
|
46
|
+
(0, _defineProperty2["default"])(this, "needsRender", true);
|
|
47
|
+
(0, _defineProperty2["default"])(this, "scene", new THREE.Scene());
|
|
48
|
+
(0, _defineProperty2["default"])(this, "camera", new THREE.PerspectiveCamera(60, 1, 0.1, 1000));
|
|
49
|
+
(0, _defineProperty2["default"])(this, "model", new THREE.Object3D());
|
|
50
|
+
(0, _defineProperty2["default"])(this, "renderer", null);
|
|
51
|
+
(0, _defineProperty2["default"])(this, "initRendererIfNeeds", function () {
|
|
36
52
|
if (!_this.renderer) {
|
|
37
53
|
_this.renderer = new THREE.WebGLRenderer({
|
|
38
54
|
antialias: false,
|
|
@@ -46,8 +62,7 @@ var ModelViewController = function ModelViewController() {
|
|
|
46
62
|
|
|
47
63
|
return _this.renderer;
|
|
48
64
|
});
|
|
49
|
-
|
|
50
|
-
_defineProperty(this, "modelWillLoad", function () {
|
|
65
|
+
(0, _defineProperty2["default"])(this, "modelWillLoad", function () {
|
|
51
66
|
_this.model.traverse(function (object) {
|
|
52
67
|
if (object instanceof THREE.Mesh) {
|
|
53
68
|
var materials = [].concat(object.material);
|
|
@@ -65,8 +80,7 @@ var ModelViewController = function ModelViewController() {
|
|
|
65
80
|
|
|
66
81
|
_this.update();
|
|
67
82
|
});
|
|
68
|
-
|
|
69
|
-
_defineProperty(this, "refresh", function () {
|
|
83
|
+
(0, _defineProperty2["default"])(this, "refresh", function () {
|
|
70
84
|
var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
71
85
|
if (!_this.renderer) return;
|
|
72
86
|
var element = _this.renderer.domElement;
|
|
@@ -88,8 +102,7 @@ var ModelViewController = function ModelViewController() {
|
|
|
88
102
|
|
|
89
103
|
_this.needsRender = true;
|
|
90
104
|
});
|
|
91
|
-
|
|
92
|
-
_defineProperty(this, "cameraDistance", function () {// const bounding = five.model.bounding
|
|
105
|
+
(0, _defineProperty2["default"])(this, "cameraDistance", function () {// const bounding = five.model.bounding
|
|
93
106
|
// const { fov, aspect } = this.camera
|
|
94
107
|
// const radius = Math.pow(
|
|
95
108
|
// Math.pow(bounding.max.x - bounding.min.x + 2, 2) +
|
|
@@ -102,8 +115,7 @@ var ModelViewController = function ModelViewController() {
|
|
|
102
115
|
// if (aspect < 1) distance = distance / aspect
|
|
103
116
|
// return isNaN(distance) ? radius : distance
|
|
104
117
|
});
|
|
105
|
-
|
|
106
|
-
_defineProperty(this, "update", function () {// const { longitude } = five.getLongitudeAndLatitude()
|
|
118
|
+
(0, _defineProperty2["default"])(this, "update", function () {// const { longitude } = five.getLongitudeAndLatitude()
|
|
107
119
|
// const latitude = Math.PI / 4
|
|
108
120
|
// const distance = cameraDistance()
|
|
109
121
|
// const lookAt = five.model.bounding.getCenter(new THREE.Vector3())
|
|
@@ -116,8 +128,7 @@ var ModelViewController = function ModelViewController() {
|
|
|
116
128
|
// camera.lookAt(lookAt)
|
|
117
129
|
// needsRender = true
|
|
118
130
|
});
|
|
119
|
-
|
|
120
|
-
_defineProperty(this, "render", function () {// if (needsRender !== true) return
|
|
131
|
+
(0, _defineProperty2["default"])(this, "render", function () {// if (needsRender !== true) return
|
|
121
132
|
// if (!renderer) return
|
|
122
133
|
// if (!renderer.domElement.parentNode) return
|
|
123
134
|
// const parentNode = renderer.domElement.parentNode as HTMLElement
|
|
@@ -125,7 +136,6 @@ var ModelViewController = function ModelViewController() {
|
|
|
125
136
|
// renderer.render(scene, camera)
|
|
126
137
|
// needsRender = false
|
|
127
138
|
});
|
|
128
|
-
|
|
129
139
|
{
|
|
130
140
|
var light = new THREE.DirectionalLight(0xffffff, 0.1);
|
|
131
141
|
light.position.copy(new THREE.Vector3(1, 1, 1));
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
+
|
|
3
7
|
Object.defineProperty(exports, "__esModule", {
|
|
4
8
|
value: true
|
|
5
9
|
});
|
|
@@ -7,8 +11,6 @@ exports["default"] = ModelView;
|
|
|
7
11
|
|
|
8
12
|
var _react = _interopRequireDefault(require("react"));
|
|
9
13
|
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
14
|
/**
|
|
13
15
|
* 户型雷达图
|
|
14
16
|
*
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
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 _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
18
|
|
|
5
19
|
Object.defineProperty(exports, "__esModule", {
|
|
6
20
|
value: true
|
package/data/1aGKl9JmrlXMXx8d.js
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export declare const work: {
|
|
2
|
+
_signature: string;
|
|
3
|
+
allow_hosts: string[];
|
|
4
|
+
base_url: string;
|
|
5
|
+
certificate: string;
|
|
6
|
+
create_time: string;
|
|
7
|
+
expire_at: string;
|
|
8
|
+
initial: {
|
|
9
|
+
flag_position: number[];
|
|
10
|
+
fov: number;
|
|
11
|
+
heading: number;
|
|
12
|
+
latitude: number;
|
|
13
|
+
longitude: number;
|
|
14
|
+
pano: number;
|
|
15
|
+
pano_index: number;
|
|
16
|
+
};
|
|
17
|
+
model: {
|
|
18
|
+
file_url: string;
|
|
19
|
+
material_base_url: string;
|
|
20
|
+
material_textures: string[];
|
|
21
|
+
modify_time: string;
|
|
22
|
+
type: number;
|
|
23
|
+
};
|
|
24
|
+
observers: {
|
|
25
|
+
accessible_nodes: number[];
|
|
26
|
+
floor_index: number;
|
|
27
|
+
index: number;
|
|
28
|
+
offset_point_count: number;
|
|
29
|
+
position: number[];
|
|
30
|
+
quaternion: {
|
|
31
|
+
w: number;
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
z: number;
|
|
35
|
+
};
|
|
36
|
+
standing_position: number[];
|
|
37
|
+
visible_nodes: number[];
|
|
38
|
+
}[];
|
|
39
|
+
panorama: {
|
|
40
|
+
count: number;
|
|
41
|
+
list: {
|
|
42
|
+
back: string;
|
|
43
|
+
down: string;
|
|
44
|
+
front: string;
|
|
45
|
+
index: number;
|
|
46
|
+
left: string;
|
|
47
|
+
right: string;
|
|
48
|
+
up: string;
|
|
49
|
+
}[];
|
|
50
|
+
};
|
|
51
|
+
picture_url: string;
|
|
52
|
+
title_picture_url: string;
|
|
53
|
+
vr_code: string;
|
|
54
|
+
vr_type: string;
|
|
55
|
+
};
|