@realsee/vreo 2.6.4-alpha.5 → 3.0.0-webgpu-react18.8

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.
Files changed (174) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +6 -6
  3. package/lib/PlayController/createHTMLAudioElement.d.ts +1 -0
  4. package/lib/PlayController/createHTMLAudioElement.d.ts.map +1 -0
  5. package/lib/PlayController/index.d.ts +14 -24
  6. package/lib/PlayController/index.d.ts.map +1 -0
  7. package/lib/PlayController/index.js +74 -210
  8. package/lib/PlayController/index.js.map +1 -0
  9. package/lib/Player/App.d.ts +2 -2
  10. package/lib/Player/App.d.ts.map +1 -0
  11. package/lib/Player/Controller.d.ts +11 -6
  12. package/lib/Player/Controller.d.ts.map +1 -0
  13. package/lib/Player/PlaybackLifecycle.d.ts +1 -0
  14. package/lib/Player/PlaybackLifecycle.d.ts.map +1 -0
  15. package/lib/Player/custom/SpatialScenePanel/index.d.ts +2 -2
  16. package/lib/Player/custom/SpatialScenePanel/index.d.ts.map +1 -0
  17. package/lib/Player/hooks.d.ts +3 -2
  18. package/lib/Player/hooks.d.ts.map +1 -0
  19. package/lib/Player/index.d.ts +3 -2
  20. package/lib/Player/index.d.ts.map +1 -0
  21. package/lib/Player/index.js +1769 -430
  22. package/lib/Player/index.js.map +1 -0
  23. package/lib/Player/modules/Drawer/index.d.ts +2 -2
  24. package/lib/Player/modules/Drawer/index.d.ts.map +1 -0
  25. package/lib/Player/modules/PopUp/index.d.ts +2 -2
  26. package/lib/Player/modules/PopUp/index.d.ts.map +1 -0
  27. package/lib/Player/modules/ResizeObserver/index.d.ts +2 -2
  28. package/lib/Player/modules/ResizeObserver/index.d.ts.map +1 -0
  29. package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +5 -2
  30. package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts.map +1 -0
  31. package/lib/Player/modules/VideoAgent/VideoAgentScene.d.ts +8 -5
  32. package/lib/Player/modules/VideoAgent/VideoAgentScene.d.ts.map +1 -0
  33. package/lib/Player/modules/VideoAgent/index.d.ts +11 -2
  34. package/lib/Player/modules/VideoAgent/index.d.ts.map +1 -0
  35. package/lib/Player/modules/Wave/index.d.ts +2 -2
  36. package/lib/Player/modules/Wave/index.d.ts.map +1 -0
  37. package/lib/Player/modules/keyframes/BgMusic/index.d.ts +2 -2
  38. package/lib/Player/modules/keyframes/BgMusic/index.d.ts.map +1 -0
  39. package/lib/Player/modules/keyframes/CameraMovement/index.d.ts +2 -2
  40. package/lib/Player/modules/keyframes/CameraMovement/index.d.ts.map +1 -0
  41. package/lib/Player/modules/keyframes/InfoPanel/index.d.ts +2 -2
  42. package/lib/Player/modules/keyframes/InfoPanel/index.d.ts.map +1 -0
  43. package/lib/Player/modules/keyframes/ModelVideo/index.d.ts +2 -2
  44. package/lib/Player/modules/keyframes/ModelVideo/index.d.ts.map +1 -0
  45. package/lib/Player/modules/keyframes/PanoEffect/index.d.ts +2 -2
  46. package/lib/Player/modules/keyframes/PanoEffect/index.d.ts.map +1 -0
  47. package/lib/Player/modules/keyframes/PanoEffect/lineAnime.d.ts +3 -2
  48. package/lib/Player/modules/keyframes/PanoEffect/lineAnime.d.ts.map +1 -0
  49. package/lib/Player/modules/keyframes/PanoTag/index.d.ts +1 -0
  50. package/lib/Player/modules/keyframes/PanoTag/index.d.ts.map +1 -0
  51. package/lib/Player/modules/keyframes/PanoTextLabel/index.d.ts +2 -2
  52. package/lib/Player/modules/keyframes/PanoTextLabel/index.d.ts.map +1 -0
  53. package/lib/Player/modules/keyframes/Prompter/index.d.ts +2 -2
  54. package/lib/Player/modules/keyframes/Prompter/index.d.ts.map +1 -0
  55. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.d.ts +2 -2
  56. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.d.ts.map +1 -0
  57. package/lib/Player/modules/keyframes/VideoEffect/index.d.ts +2 -2
  58. package/lib/Player/modules/keyframes/VideoEffect/index.d.ts.map +1 -0
  59. package/lib/Player/playback-types.d.ts +1 -0
  60. package/lib/Player/playback-types.d.ts.map +1 -0
  61. package/lib/Player/typings.d.ts +2 -1
  62. package/lib/Player/typings.d.ts.map +1 -0
  63. package/lib/chunks/index-BgPSzRSs.js +93 -0
  64. package/lib/chunks/index-BgPSzRSs.js.map +1 -0
  65. package/lib/chunks/index-CunyJn6H.js +51 -0
  66. package/lib/chunks/index-CunyJn6H.js.map +1 -0
  67. package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.d.ts +2 -1
  68. package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.d.ts.map +1 -0
  69. package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.d.ts +5 -6
  70. package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.d.ts.map +1 -0
  71. package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.d.ts +1 -0
  72. package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.d.ts.map +1 -0
  73. package/lib/fivePlugins/CSS3DRenderPlugin/index.d.ts +5 -22
  74. package/lib/fivePlugins/CSS3DRenderPlugin/index.d.ts.map +1 -0
  75. package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.d.ts +2 -1
  76. package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.d.ts.map +1 -0
  77. package/lib/fivePlugins/CameraMovementPlugin/index.d.ts +2 -1
  78. package/lib/fivePlugins/CameraMovementPlugin/index.d.ts.map +1 -0
  79. package/lib/fivePlugins/CameraMovementPlugin/typings.d.ts +2 -1
  80. package/lib/fivePlugins/CameraMovementPlugin/typings.d.ts.map +1 -0
  81. package/lib/fivePlugins/ModelTVVideoPlugin/index.d.ts +2 -1
  82. package/lib/fivePlugins/ModelTVVideoPlugin/index.d.ts.map +1 -0
  83. package/lib/index.d.ts +3 -0
  84. package/lib/index.d.ts.map +1 -0
  85. package/lib/index.js +12 -1
  86. package/lib/index.js.map +1 -0
  87. package/lib/plugins/CSS3DRenderPlugin.js +115 -0
  88. package/lib/plugins/CSS3DRenderPlugin.js.map +1 -0
  89. package/lib/plugins/CameraMovementPlugin.js +6 -0
  90. package/lib/plugins/CameraMovementPlugin.js.map +1 -0
  91. package/lib/plugins/ModelTVVideoPlugin.js +162 -0
  92. package/lib/plugins/ModelTVVideoPlugin.js.map +1 -0
  93. package/lib/react/index.d.ts +5 -4
  94. package/lib/react/index.d.ts.map +1 -0
  95. package/lib/react/index.js +39 -226
  96. package/lib/react/index.js.map +1 -0
  97. package/lib/shared-utils/Audio.d.ts +3 -1
  98. package/lib/shared-utils/Audio.d.ts.map +1 -0
  99. package/lib/shared-utils/AudioLike.d.ts +2 -1
  100. package/lib/shared-utils/AudioLike.d.ts.map +1 -0
  101. package/lib/shared-utils/Preloader.d.ts +1 -0
  102. package/lib/shared-utils/Preloader.d.ts.map +1 -0
  103. package/lib/shared-utils/addResizeListener.d.ts +2 -1
  104. package/lib/shared-utils/addResizeListener.d.ts.map +1 -0
  105. package/lib/shared-utils/animationFrame/BetterTween.d.ts +1 -0
  106. package/lib/shared-utils/animationFrame/BetterTween.d.ts.map +1 -0
  107. package/lib/shared-utils/animationFrame/index.d.ts +5 -14
  108. package/lib/shared-utils/animationFrame/index.d.ts.map +1 -0
  109. package/lib/shared-utils/animationFrame/tween.d.ts +1 -0
  110. package/lib/shared-utils/animationFrame/tween.d.ts.map +1 -0
  111. package/lib/shared-utils/createTransMatrix.d.ts +3 -1
  112. package/lib/shared-utils/createTransMatrix.d.ts.map +1 -0
  113. package/lib/shared-utils/getFileExpandedName.d.ts +1 -0
  114. package/lib/shared-utils/getFileExpandedName.d.ts.map +1 -0
  115. package/lib/shared-utils/getMediaInfo.d.ts +1 -0
  116. package/lib/shared-utils/getMediaInfo.d.ts.map +1 -0
  117. package/lib/shared-utils/setElementDataset.d.ts +1 -0
  118. package/lib/shared-utils/setElementDataset.d.ts.map +1 -0
  119. package/lib/timeline/index.d.ts +18 -0
  120. package/lib/timeline/index.d.ts.map +1 -0
  121. package/lib/types/index.js +10 -0
  122. package/lib/types/index.js.map +1 -0
  123. package/lib/typings/VreoUnit.d.ts +2 -1
  124. package/lib/typings/VreoUnit.d.ts.map +1 -0
  125. package/lib/typings/index.d.ts +1 -0
  126. package/lib/typings/index.d.ts.map +1 -0
  127. package/package.json +51 -71
  128. package/lib/PlayController/createHTMLAudioElement.js +0 -30
  129. package/lib/Player/App.js +0 -52
  130. package/lib/Player/Controller.js +0 -530
  131. package/lib/Player/PlaybackLifecycle.js +0 -117
  132. package/lib/Player/custom/SpatialScenePanel/index.js +0 -263
  133. package/lib/Player/hooks.js +0 -22
  134. package/lib/Player/modules/Drawer/index.js +0 -39
  135. package/lib/Player/modules/PopUp/index.js +0 -23
  136. package/lib/Player/modules/ResizeObserver/index.js +0 -22
  137. package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +0 -445
  138. package/lib/Player/modules/VideoAgent/VideoAgentScene.js +0 -53
  139. package/lib/Player/modules/VideoAgent/index.js +0 -72
  140. package/lib/Player/modules/Wave/index.js +0 -171
  141. package/lib/Player/modules/keyframes/BgMusic/index.js +0 -65
  142. package/lib/Player/modules/keyframes/CameraMovement/index.js +0 -73
  143. package/lib/Player/modules/keyframes/InfoPanel/index.js +0 -170
  144. package/lib/Player/modules/keyframes/ModelVideo/index.js +0 -126
  145. package/lib/Player/modules/keyframes/PanoEffect/index.js +0 -99
  146. package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +0 -30
  147. package/lib/Player/modules/keyframes/PanoTag/index.js +0 -110
  148. package/lib/Player/modules/keyframes/PanoTextLabel/index.js +0 -122
  149. package/lib/Player/modules/keyframes/Prompter/index.js +0 -56
  150. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +0 -98
  151. package/lib/Player/modules/keyframes/VideoEffect/index.js +0 -152
  152. package/lib/Player/playback-types.js +0 -1
  153. package/lib/Player/typings.js +0 -1
  154. package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +0 -4
  155. package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +0 -25
  156. package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +0 -4
  157. package/lib/fivePlugins/CSS3DRenderPlugin/index.js +0 -226
  158. package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +0 -8
  159. package/lib/fivePlugins/CameraMovementPlugin/index.js +0 -238
  160. package/lib/fivePlugins/CameraMovementPlugin/typings.js +0 -15
  161. package/lib/fivePlugins/ModelTVVideoPlugin/index.js +0 -347
  162. package/lib/shared-utils/Audio.js +0 -147
  163. package/lib/shared-utils/AudioLike.js +0 -120
  164. package/lib/shared-utils/Preloader.js +0 -37
  165. package/lib/shared-utils/addResizeListener.js +0 -39
  166. package/lib/shared-utils/animationFrame/BetterTween.js +0 -56
  167. package/lib/shared-utils/animationFrame/index.js +0 -52
  168. package/lib/shared-utils/animationFrame/tween.js +0 -56
  169. package/lib/shared-utils/createTransMatrix.js +0 -12
  170. package/lib/shared-utils/getFileExpandedName.js +0 -6
  171. package/lib/shared-utils/getMediaInfo.js +0 -54
  172. package/lib/shared-utils/setElementDataset.js +0 -16
  173. package/lib/typings/VreoUnit.js +0 -171
  174. package/lib/typings/index.js +0 -1
@@ -1,99 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import * as React from 'react';
3
- import { Vector3 } from 'three';
4
- import classNames from 'classnames';
5
- import lineAnime from "./lineAnime.js";
6
- import { useController, useFiveInstance, useFiveProject2d } from "../../../hooks.js";
7
- import { VreoKeyframeEnum } from "../../../../typings/VreoUnit.js";
8
- export function PanoEffect() {
9
- var _React$useState = React.useState(null),
10
- _React$useState2 = _slicedToArray(_React$useState, 2),
11
- state = _React$useState2[0],
12
- setState = _React$useState2[1];
13
- var five = useFiveInstance();
14
- var lineRef = React.useRef(null);
15
- var _React$useState3 = React.useState(null),
16
- _React$useState4 = _slicedToArray(_React$useState3, 2),
17
- pos = _React$useState4[0],
18
- setPos = _React$useState4[1];
19
- var timeoutRef = React.useRef();
20
- var controller = useController();
21
- var project2d = useFiveProject2d();
22
- var delLine = function delLine() {
23
- if (lineRef.current) {
24
- lineRef.current.dispose();
25
- }
26
- };
27
- React.useEffect(function () {
28
- var callback = function callback(keyframe) {
29
- var start = keyframe.start,
30
- end = keyframe.end,
31
- data = keyframe.data;
32
- var videoEffectData = data;
33
- var _videoEffectData$twoV = _slicedToArray(videoEffectData.twoVertexs, 2),
34
- v1 = _videoEffectData$twoV[0],
35
- v2 = _videoEffectData$twoV[1];
36
- var p1 = new Vector3(v1.x, v1.y, v1.z);
37
- var p2 = new Vector3(v2.x, v2.y, v2.z);
38
- lineRef.current = lineAnime(five, p1.clone(), p2.clone());
39
- lineRef.current.play();
40
- var center = p1.lerp(p2, 0.5);
41
- var distance = p1.distanceTo(p2);
42
- var p = project2d(center);
43
- if (!p) return;
44
- var left = p.x,
45
- top = p.y;
46
- setState({
47
- center: center,
48
- distance: distance
49
- });
50
- setPos({
51
- left: left,
52
- top: top
53
- });
54
- timeoutRef.current = setTimeout(function () {
55
- setState(null);
56
- setPos(null);
57
- delLine();
58
- }, end - start);
59
- };
60
- controller.on(VreoKeyframeEnum.PanoEffect, callback);
61
- return function () {
62
- controller.off(VreoKeyframeEnum.PanoEffect, callback);
63
- if (timeoutRef.current) {
64
- clearTimeout(timeoutRef.current);
65
- }
66
- delLine();
67
- };
68
- }, [controller]);
69
- React.useEffect(function () {
70
- var callback = function callback() {
71
- if (!(state !== null && state !== void 0 && state.center)) return;
72
- var _state$center = state.center,
73
- x = _state$center.x,
74
- y = _state$center.y,
75
- z = _state$center.z;
76
- var res = project2d(new Vector3(x, y, z));
77
- if (!res) return;
78
- var left = res.x,
79
- top = res.y;
80
- setPos({
81
- left: left,
82
- top: top
83
- });
84
- };
85
- five.on('currentStateChange', callback);
86
- return function () {
87
- five.off('currentStateChange', callback);
88
- };
89
- }, [state === null || state === void 0 ? void 0 : state.center]);
90
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
91
- className: classNames('PanoEffect', {
92
- 'PanoEffect--notHidden': state
93
- }),
94
- style: {
95
- left: ((pos === null || pos === void 0 ? void 0 : pos.left) || 0) + 'px',
96
- top: ((pos === null || pos === void 0 ? void 0 : pos.top) || 0) + 'px'
97
- }
98
- }, (state === null || state === void 0 ? void 0 : state.distance.toFixed(4)) + 'm'));
99
- }
@@ -1,30 +0,0 @@
1
- import * as THREE from 'three';
2
- import { Line as FiveLine } from '@realsee/five/line';
3
- import { tweenProgress } from "../../../../shared-utils/animationFrame/BetterTween.js";
4
- export default function lineAnime(five, startPoint, endPoint) {
5
- var pointImage = 'data:image/png;base64,' + 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAIVBMVEUAAAD////////////////////////////////////////PIev5AAAACnRSTlMAG/Py2baba05un7UgfgAAAHJJREFUKM9joBpgLHVSCRdA4metAoJlCJHmVWBgAeNzroKCCVCBLpjACqgJVjCBxRBT2FbBQQJYQAohsBAsUIUQWA4WiEIILAULeCEEloAFtBACizAEMLRgGIphLabDMJ2O6TlM72MGECIIMQIZIxqoBQCPvpJ/e9FaAAAAAABJRU5ErkJggg==';
6
- var pointTexture = new THREE.TextureLoader().load(pointImage);
7
- var color = new THREE.Color(0xffffff);
8
- var line = new FiveLine();
9
- line.setMaterial({
10
- linewidth: 2,
11
- color: color
12
- });
13
- var pointMaterial = line.points.material;
14
- pointMaterial.map = pointTexture;
15
- pointMaterial.color.set(color);
16
- line.line.material.depthTest = false;
17
- return tweenProgress().onUpdate(function (_ref) {
18
- var progress = _ref.progress;
19
- var lerpLeft = 0.5 - progress / 2;
20
- var lerpRight = 0.5 + progress / 2;
21
- var leftPoint = startPoint.clone().lerp(endPoint, lerpLeft);
22
- var rightPoint = startPoint.clone().lerp(endPoint, lerpRight);
23
- line.setPoints(leftPoint, rightPoint);
24
- }).onStart(function () {
25
- return five.scene.add(line);
26
- }).onDispose(function () {
27
- five.scene.remove(line);
28
- five.needsRender = true;
29
- });
30
- }
@@ -1,110 +0,0 @@
1
- import * as React from 'react';
2
- import { useController, useFiveInstance } from "../../../hooks.js";
3
- import { VreoKeyframeEnum } from "../../../../typings/VreoUnit.js";
4
- import { PanoTagPlugin } from '@realsee/dnalogel';
5
- export function PanoTag() {
6
- var timeoutRef = React.useRef();
7
- var controller = useController();
8
- var five = useFiveInstance();
9
- var panoTagPlugin = React.useRef(PanoTagPlugin(five, {
10
- config: {
11
- globalConfig: {
12
- visibleConfig: {
13
- keep: 'visible'
14
- },
15
- unfoldedConfig: {
16
- autoUnfold: false,
17
- unfoldDistance: {
18
- max: 100
19
- }
20
- }
21
- }
22
- }
23
- }));
24
- React.useEffect(function () {
25
- var _controller$configs;
26
- if (((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.keyframeMap.PanoTag) === false) {
27
- return;
28
- }
29
- var callback = function callback(keyframe) {
30
- var run = controller.playback.capture();
31
- if (!panoTagPlugin.current || !(run !== null && run !== void 0 && run.valid())) return;
32
- var start = keyframe.start,
33
- end = keyframe.end,
34
- data = keyframe.data;
35
- var panoTagData = data;
36
- var id = Date.now().toString();
37
- var pointType = 'PointTag';
38
- var dimensionType = '2D';
39
- var position = [panoTagData.vertex.x, panoTagData.vertex.y, panoTagData.vertex.z];
40
- var tag = function () {
41
- if (panoTagData.imgUrl) {
42
- return {
43
- id: id,
44
- pointType: pointType,
45
- position: position,
46
- dimensionType: dimensionType,
47
- contentType: 'ImageText',
48
- stickType: '2DPoint',
49
- data: {
50
- text: panoTagData.text,
51
- mediaData: [{
52
- type: 'Image',
53
- url: panoTagData.imgUrl
54
- }]
55
- }
56
- };
57
- } else {
58
- return {
59
- id: id,
60
- pointType: pointType,
61
- position: position,
62
- dimensionType: dimensionType,
63
- contentType: 'Text',
64
- stickType: '2DPoint',
65
- data: {
66
- text: panoTagData.text
67
- }
68
- };
69
- }
70
- }();
71
-
72
- // show
73
- panoTagPlugin.current.load({
74
- tagList: [tag]
75
- });
76
- var tagInstance = panoTagPlugin.current.getTagById(id);
77
- if (tagInstance) {
78
- tagInstance.setMediaManager(run.mediaManager);
79
- tagInstance.state.unfolded = true;
80
- panoTagPlugin.current.updateRenderAllTags();
81
- }
82
- timeoutRef.current = setTimeout(function () {
83
- var _tag$hooks;
84
- // clear
85
- var tag = panoTagPlugin.current.getTagById(id);
86
- if (!tag) return;
87
- if (tag.state) {
88
- tag.state.unfolded = false;
89
- panoTagPlugin.current.updateRenderAllTags();
90
- }
91
- (_tag$hooks = tag.hooks) === null || _tag$hooks === void 0 || _tag$hooks.on('folded', function () {
92
- setTimeout(function () {
93
- if (tag.state) {
94
- tag.state.visible = false;
95
- panoTagPlugin.current.destroyTagById(id);
96
- }
97
- }, 1500);
98
- });
99
- }, end - start);
100
- };
101
- controller.on(VreoKeyframeEnum.PanoTag, callback);
102
- return function () {
103
- controller.off(VreoKeyframeEnum.PanoTag, callback);
104
- if (timeoutRef.current) {
105
- clearTimeout(timeoutRef.current);
106
- }
107
- };
108
- }, [controller]);
109
- return null;
110
- }
@@ -1,122 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import * as React from 'react';
3
- import * as THREE from 'three';
4
- import { createRoot } from 'react-dom/client';
5
- import { Vector3, Quaternion } from 'three';
6
- import { useController, useFiveInstance } from "../../../hooks.js";
7
- import { CSS3DRenderPlugin } from "../../../../fivePlugins/CSS3DRenderPlugin/index.js";
8
- import { VreoKeyframeEnum } from "../../../../typings/VreoUnit.js";
9
- /**
10
- * 通过传入中心点确定矩形框架容器的四个点:
11
- * 1. 已知矩形长宽和中心点
12
- * 2. 借助planeGeometry生成垂直相机视角的平面上的四个点
13
- * 3. 通过向量相加,平行四边形法则获取到移动position后的面上四个点
14
- */
15
- var calcPoints = function calcPoints(centerPoint, normal, wrapperLength, wrapperWidth) {
16
- // 375px 对应 1m
17
- var length = wrapperLength / 375;
18
- var width = wrapperWidth / 375;
19
- var geometry = new THREE.PlaneGeometry(length, width);
20
- if (normal) {
21
- var lookPoint = new THREE.Vector3(normal.x + centerPoint.x, normal.y + centerPoint.y, normal.z + centerPoint.z);
22
- geometry.lookAt(lookPoint);
23
- }
24
- // const pointgeometry = new THREE.Geometry()
25
- // pointgeometry.vertices.push(cameraPosition)
26
- // const pointmaterial = new THREE.PointsMaterial({
27
- // color: 0xffffff,
28
- // size: 0.4,
29
- // })
30
- // _point = new THREE.Points(pointgeometry, pointmaterial)
31
- // console.log(cameraPosition)
32
-
33
- var material = new THREE.MeshBasicMaterial({
34
- color: 0xffff00,
35
- side: THREE.DoubleSide
36
- });
37
- var plane = new THREE.Mesh(geometry, material);
38
- var v0 = centerPoint.clone();
39
- plane.position.copy(v0);
40
-
41
- // 计算传入的四个点的坐标
42
- var _plane$geometry$verti = _slicedToArray(plane.geometry.vertices, 4),
43
- v1 = _plane$geometry$verti[0],
44
- v2 = _plane$geometry$verti[1],
45
- v3 = _plane$geometry$verti[2],
46
- v4 = _plane$geometry$verti[3];
47
- var downLeft = v0.clone().add(v4);
48
- var downRight = v0.clone().add(v3);
49
- var upLeft = v0.clone().add(v2);
50
- var upRight = v0.clone().add(v1);
51
-
52
- // 插件使用要求:矩形四个点位数据,顺序为**必须**为左下、右下、右上、左上
53
- return [downLeft, downRight, upRight, upLeft];
54
- };
55
-
56
- /**
57
- * 空间文本标签。
58
- */
59
- export function PanoTextLabel() {
60
- var timeoutRef = React.useRef();
61
- var controller = useController();
62
- var five = useFiveInstance();
63
- var ref = React.useRef();
64
- React.useEffect(function () {
65
- var _controller$configs;
66
- if (((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.keyframeMap.PanoTextLabel) === false) {
67
- return;
68
- }
69
- var callback = function callback(keyframe) {
70
- var _panoTextLabelData$no, _panoTextLabelData$no2, _panoTextLabelData$no3;
71
- var start = keyframe.start,
72
- end = keyframe.end,
73
- data = keyframe.data;
74
- var panoTextLabelData = data;
75
- // 增加无文本情况的判断
76
- if (data.text === '') return;
77
- var _panoTextLabelData$ve = panoTextLabelData.vertex,
78
- x = _panoTextLabelData$ve.x,
79
- y = _panoTextLabelData$ve.y,
80
- z = _panoTextLabelData$ve.z;
81
- var centerPoint = new Vector3(x, y, z);
82
- var normal = new Vector3((_panoTextLabelData$no = panoTextLabelData.normal) === null || _panoTextLabelData$no === void 0 ? void 0 : _panoTextLabelData$no.x, (_panoTextLabelData$no2 = panoTextLabelData.normal) === null || _panoTextLabelData$no2 === void 0 ? void 0 : _panoTextLabelData$no2.y, (_panoTextLabelData$no3 = panoTextLabelData.normal) === null || _panoTextLabelData$no3 === void 0 ? void 0 : _panoTextLabelData$no3.z);
83
- // 生成传入的四个点,将文本框最大宽度定在200px,最高高度在30px
84
- var wrapperLength = 200;
85
- var wrapperWidth = 30;
86
- var points = calcPoints(centerPoint, panoTextLabelData.normal && normal, wrapperLength, wrapperWidth);
87
- if (!ref.current) ref.current = CSS3DRenderPlugin(five);
88
- var container = ref.current.create3DDomContainer(points);
89
- var css3DObject = container === null || container === void 0 ? void 0 : container.css3DObject;
90
- // 将获取的mesh进行旋转操作,根据欧拉角去进行mesh的变换
91
- if (data.quaternion) {
92
- var quaternion = new Quaternion(data.quaternion.x, data.quaternion.y, data.quaternion.z, data.quaternion.w);
93
- css3DObject === null || css3DObject === void 0 || css3DObject.quaternion.copy(quaternion);
94
- }
95
- if (container !== null && container !== void 0 && container.container) {
96
- var root = createRoot(container.container);
97
- root.render(/*#__PURE__*/React.createElement("div", {
98
- className: "PanoTextLabel PanoTextLabel--notHidden"
99
- }, /*#__PURE__*/React.createElement("div", {
100
- className: "PanoTextLabel-wrapper"
101
- }, /*#__PURE__*/React.createElement("div", {
102
- style: {
103
- fontSize: "".concat(data.fontSize || 16, "px")
104
- },
105
- className: "PanoText-innerText"
106
- }, data.text || ''))));
107
- }
108
- timeoutRef.current = setTimeout(function () {
109
- var _ref$current;
110
- (_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.disposeAll();
111
- }, end - start);
112
- };
113
- controller.on(VreoKeyframeEnum.PanoTextLabel, callback);
114
- return function () {
115
- controller.off(VreoKeyframeEnum.PanoTextLabel, callback);
116
- if (timeoutRef.current) {
117
- clearTimeout(timeoutRef.current);
118
- }
119
- };
120
- }, [controller]);
121
- return /*#__PURE__*/React.createElement(React.Fragment, null);
122
- }
@@ -1,56 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
- import * as React from 'react';
4
- import classNames from 'classnames';
5
- import { useController } from "../../../hooks.js";
6
- import { VreoKeyframeEnum } from "../../../../typings/VreoUnit.js";
7
- export function Prompter() {
8
- var _React$useState = React.useState(''),
9
- _React$useState2 = _slicedToArray(_React$useState, 2),
10
- text = _React$useState2[0],
11
- setText = _React$useState2[1];
12
- var _React$useState3 = React.useState(true),
13
- _React$useState4 = _slicedToArray(_React$useState3, 2),
14
- hidden = _React$useState4[0],
15
- setHidden = _React$useState4[1];
16
- var ref = React.useRef(null);
17
- var controller = useController();
18
- React.useEffect(function () {
19
- var _controller$configs;
20
- if (((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.keyframeMap.Prompter) === false) {
21
- return;
22
- }
23
- var callback = function callback(keyframe) {
24
- var start = keyframe.start,
25
- end = keyframe.end,
26
- data = keyframe.data;
27
- setText(data.text);
28
- setHidden(false);
29
- if (ref.current) {
30
- clearTimeout(ref.current);
31
- ref.current = null;
32
- }
33
- ref.current = setTimeout(function () {
34
- setHidden(true);
35
- setText('');
36
- // setTimeout(() => setText(''), 500)
37
-
38
- if (ref.current) clearTimeout(ref.current);
39
- ref.current = null;
40
- }, end - start);
41
- };
42
- controller.on(VreoKeyframeEnum.Prompter, callback);
43
- return function () {
44
- controller.off(VreoKeyframeEnum.Prompter, callback);
45
- };
46
- }, [controller]);
47
- return /*#__PURE__*/React.createElement("div", {
48
- className: classNames('vreo-prompter', _defineProperty({
49
- 'vreo-prompter--hidden': hidden
50
- }, "vreo-prompter-left--".concat(controller.agentType), true))
51
- }, /*#__PURE__*/React.createElement("div", {
52
- className: "vreo-prompter-text"
53
- }, /*#__PURE__*/React.createElement("div", {
54
- className: "vreo-prompter-innerText"
55
- }, text)));
56
- }
@@ -1,98 +0,0 @@
1
- import * as React from 'react';
2
- import { parseWork } from '@realsee/five';
3
- import { useController, useFiveInstance } from "../../../hooks.js";
4
- import { VreoKeyframeEnum } from "../../../../typings/VreoUnit.js";
5
- export function UpdateVRPanorama() {
6
- var controller = useController();
7
- var five = useFiveInstance();
8
- var deafultWorkRef = React.useRef(null);
9
- var updateWorkRef = React.useRef(null);
10
-
11
- // 恢复默认 VR
12
- var restoreCallback = React.useCallback(function () {
13
- // 先清理掉 之前的 VR 数据备份
14
- updateWorkRef.current = null;
15
- if (deafultWorkRef.current) {
16
- var work = parseWork(deafultWorkRef.current);
17
- five.load(work);
18
- }
19
- }, []);
20
-
21
- // 暂停时: 恢复默认 VR
22
- var pausedCallback = React.useCallback(function () {
23
- if (deafultWorkRef.current) {
24
- var work = parseWork(deafultWorkRef.current);
25
- Object.assign(window, {
26
- $rawWork: work
27
- });
28
- five.load(work);
29
- }
30
- }, []);
31
-
32
- // 播放时:如果暂停前有更新 VR 需要还原
33
- var playingCallback = React.useCallback(function () {
34
- if (!updateWorkRef.current) {
35
- return;
36
- }
37
- five.load(updateWorkRef.current);
38
- }, []);
39
- React.useEffect(function () {
40
- var callback = function callback(keyframe) {
41
- var _five$work, _five$work2;
42
- if (!deafultWorkRef.current && (_five$work = five.work) !== null && _five$work !== void 0 && (_five$work = _five$work.raw) !== null && _five$work !== void 0 && _five$work.works) {
43
- deafultWorkRef.current = five.work.raw.works;
44
- }
45
- var data = keyframe.data;
46
-
47
- // 如果数据中有新 work 数据,则直接载入
48
- if (data.work) {
49
- updateWorkRef.current = parseWork(data.work);
50
- five.load(updateWorkRef.current);
51
- return;
52
- }
53
- var lastRawWork = (_five$work2 = five.work) === null || _five$work2 === void 0 || (_five$work2 = _five$work2.raw) === null || _five$work2 === void 0 || (_five$work2 = _five$work2.works) === null || _five$work2 === void 0 ? void 0 : _five$work2[0];
54
- if (!lastRawWork) {
55
- console.warn('UpdateVRPanorama: 没有可用的 work 数据');
56
- return;
57
- }
58
-
59
- // 动态场景:不提供完成的签名数据,需重新整理
60
- if (data.dynamic_scene && !data.panorama) {
61
- var lastWork = JSON.parse(lastRawWork);
62
- var panorama = lastWork.panorama;
63
- var index = data.dynamic_scene.images.index;
64
- panorama.list[index] = data.dynamic_scene.images;
65
- data.panorama = panorama;
66
- delete data.dynamic_scene;
67
- }
68
- Object.assign(window, {
69
- $work1: JSON.parse(lastRawWork),
70
- $work2: data,
71
- parseWork: parseWork
72
- });
73
- updateWorkRef.current = parseWork([lastRawWork, data]);
74
- five.load(updateWorkRef.current);
75
- };
76
- controller.on(VreoKeyframeEnum.UpdateVRPanorama, callback);
77
-
78
- // 离开 将之前的内容清空
79
- controller.on(VreoKeyframeEnum.Exit, restoreCallback);
80
-
81
- // 新载入数据 将之前的内容清空
82
- controller.on('loaded', restoreCallback);
83
-
84
- // 暂停 回到默认状态
85
- controller.on('paused', pausedCallback);
86
- // 播放 回归暂停前状态
87
- controller.on('playing', playingCallback);
88
- return function () {
89
- // 清理事件监听
90
- controller.off(VreoKeyframeEnum.UpdateVRPanorama, callback);
91
- controller.off(VreoKeyframeEnum.Exit, restoreCallback);
92
- controller.off('loaded', restoreCallback);
93
- controller.off('paused', pausedCallback);
94
- controller.off('playing', playingCallback);
95
- };
96
- }, []);
97
- return /*#__PURE__*/React.createElement(React.Fragment, null);
98
- }
@@ -1,152 +0,0 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
- function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
4
- function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
5
- import classNames from 'classnames';
6
- import * as React from 'react';
7
- // import { Preloader } from '../../../../shared-utils/Preloader'
8
- import { VreoKeyframeEnum } from "../../../../typings/VreoUnit.js";
9
- import { useController, useFiveInstance } from "../../../hooks.js"; // const emptyVideo = '//vr-static.realsee-cdn.cn/release/web/leisure.69fd3522.mov'
10
- var PI = Math.PI;
11
- var PI_2 = PI * 2;
12
- export function VideoEffect() {
13
- var ref = React.useRef(null);
14
- var videoRef = React.useRef();
15
- var controller = useController();
16
- var timeoutRef = React.useRef();
17
- var _React$useState = React.useState(false),
18
- _React$useState2 = _slicedToArray(_React$useState, 2),
19
- visible = _React$useState2[0],
20
- setVisible = _React$useState2[1];
21
- var five = useFiveInstance();
22
- React.useEffect(function () {
23
- var output;
24
- var generation = 0;
25
- var removeCanPlay;
26
- var callback = /*#__PURE__*/function () {
27
- var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(keyframe) {
28
- var _removeCanPlay;
29
- var start, end, _ref2, videoSrc, fov, direction, panoIndex, vector, _ref3, _ref4, longitude, latitude, currentGeneration, run, active, valid, video, media, play;
30
- return _regenerator().w(function (_context) {
31
- while (1) switch (_context.n) {
32
- case 0:
33
- start = keyframe.start, end = keyframe.end;
34
- _ref2 = keyframe.data, videoSrc = _ref2.videoSrc, fov = _ref2.fov, direction = _ref2.direction, panoIndex = _ref2.panoIndex, vector = _ref2.vector;
35
- _ref3 = function () {
36
- if (vector) {
37
- return [vector.longitude, vector.latitude];
38
- }
39
- if (!direction) {
40
- return [0, 0];
41
- }
42
- var longitude = -Math.atan2(direction.x, -direction.z);
43
- longitude = (longitude % PI_2 + PI_2) % PI_2;
44
- var latitude = -Math.asin(direction.y / 1);
45
- return [longitude, latitude];
46
- }(), _ref4 = _slicedToArray(_ref3, 2), longitude = _ref4[0], latitude = _ref4[1];
47
- destroy();
48
- currentGeneration = generation;
49
- five.setState({
50
- fov: fov,
51
- panoIndex: panoIndex,
52
- longitude: longitude,
53
- latitude: latitude
54
- }, true);
55
- (_removeCanPlay = removeCanPlay) === null || _removeCanPlay === void 0 || _removeCanPlay();
56
- run = controller.playback.capture();
57
- active = function active() {
58
- return !!(run !== null && run !== void 0 && run.valid());
59
- };
60
- valid = function valid() {
61
- return currentGeneration === generation && active();
62
- };
63
- video = videoRef.current;
64
- if (!(!video || !valid())) {
65
- _context.n = 1;
66
- break;
67
- }
68
- return _context.a(2);
69
- case 1:
70
- media = output = run.bind(video);
71
- media.muted = true;
72
- media.src = videoSrc;
73
- play = function play() {
74
- var _removeCanPlay2;
75
- (_removeCanPlay2 = removeCanPlay) === null || _removeCanPlay2 === void 0 || _removeCanPlay2();
76
- if (!valid()) return;
77
- media.muted = false;
78
- void media.play().catch(function (error) {
79
- if (valid()) {
80
- controller.playback.cancel();
81
- console.error(error);
82
- }
83
- });
84
- };
85
- removeCanPlay = function removeCanPlay() {
86
- return video.removeEventListener('canplaythrough', play);
87
- };
88
- video.addEventListener('canplaythrough', play);
89
- media.load();
90
- setVisible(true);
91
- timeoutRef.current = setTimeout(destroy, Math.max(0, end - start));
92
- case 2:
93
- return _context.a(2);
94
- }
95
- }, _callee);
96
- }));
97
- return function callback(_x) {
98
- return _ref.apply(this, arguments);
99
- };
100
- }();
101
- controller.on(VreoKeyframeEnum.VideoEffect, callback);
102
- var destroy = function destroy() {
103
- var _removeCanPlay3;
104
- ++generation;
105
- if (timeoutRef.current) {
106
- clearTimeout(timeoutRef.current);
107
- }
108
- (_removeCanPlay3 = removeCanPlay) === null || _removeCanPlay3 === void 0 || _removeCanPlay3();
109
- if (output) {
110
- output.muted = true;
111
- output.pause();
112
- output.src = '';
113
- }
114
- output = undefined;
115
- setVisible(false);
116
- };
117
- var remove = controller.playback.add(destroy);
118
- return function () {
119
- destroy();
120
- remove();
121
- controller.off(VreoKeyframeEnum.VideoEffect, callback);
122
- if (timeoutRef.current) {
123
- clearTimeout(timeoutRef.current);
124
- }
125
- };
126
- }, [controller]);
127
- React.useEffect(function () {
128
- var _controller$configs;
129
- if (!ref.current) return;
130
- var video = ((_controller$configs = controller.configs) === null || _controller$configs === void 0 || (_controller$configs = _controller$configs.videos) === null || _controller$configs === void 0 ? void 0 : _controller$configs.videoEffect) || document.createElement('video');
131
- // <video playsInline key="VideoEffect-video" className="VideoEffect-video" src={blobSrc} />
132
- video.setAttribute('playsinline', 'true');
133
- video.setAttribute('webkit-playsinline', 'true');
134
- video.autoplay = false;
135
- video.muted = true;
136
- video.setAttribute('key', 'VideoEffect-video');
137
- video.setAttribute('class', 'VideoEffect-video');
138
- videoRef.current = video;
139
- ref.current.append(videoRef.current);
140
- return function () {
141
- video.muted = true;
142
- video.pause();
143
- video.remove();
144
- };
145
- }, []);
146
- return /*#__PURE__*/React.createElement("div", {
147
- ref: ref,
148
- className: classNames('VideoEffect', {
149
- 'VideoEffect--visible': visible
150
- })
151
- });
152
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};