@realsee/vreo 1.0.0-alpha.9 → 1.1.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/README.md +46 -36
- package/lib/PlayController/index.js +1 -1
- package/lib/Player/Controller.d.ts +3 -2
- package/lib/Player/Controller.js +31 -14
- package/lib/Player/index.js +27 -16
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +2 -2
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +7 -12
- package/lib/Player/modules/VideoAgent/index.js +1 -1
- package/lib/Player/modules/Wave/index.js +160 -25
- package/lib/Player/modules/keyframes/BgMusic/index.js +52 -40
- package/lib/Player/modules/keyframes/PanoTag/index.js +1 -0
- package/lib/fivePlugins/CameraMovementPlugin/index.js +3 -2
- package/lib/shared-utils/Audio.d.ts +14 -0
- package/lib/shared-utils/Audio.js +158 -0
- package/lib/shared-utils/{AduioLike.d.ts → AudioLike.d.ts} +0 -0
- package/lib/shared-utils/{AduioLike.js → AudioLike.js} +4 -6
- package/lib/shared-utils/animationFrame/tween.d.ts +3 -58
- package/lib/shared-utils/animationFrame/tween.js +3 -9
- package/lib/typings/VreoUnit.d.ts +8 -5
- package/package.json +8 -6
- package/stylesheets/default.css +7 -2
- package/docs/.nojekyll +0 -1
- package/docs/assets/custom.css +0 -78
- package/docs/assets/highlight.css +0 -127
- package/docs/assets/icons.css +0 -1043
- package/docs/assets/icons.png +0 -0
- package/docs/assets/icons@2x.png +0 -0
- package/docs/assets/main.js +0 -52
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1414
- package/docs/assets/widgets.png +0 -0
- package/docs/assets/widgets@2x.png +0 -0
- package/docs/classes/Player.AudioLike.html +0 -52
- package/docs/classes/Player.Controller.html +0 -54
- package/docs/classes/Player.Player-1.html +0 -50
- package/docs/classes/Player.VideoAgentMesh.html +0 -142
- package/docs/classes/Player.VideoAgentScene.html +0 -1
- package/docs/demo/assets/AppReact.6ca5d1d2.js +0 -1
- package/docs/demo/assets/default.5a762ce2.js +0 -3988
- package/docs/demo/assets/default.bc4c715d.css +0 -1
- package/docs/demo/assets/dynamic.efc5200d.js +0 -1
- package/docs/demo/assets/examples.80a27156.js +0 -25
- package/docs/demo/assets/examples.dac4a6fe.css +0 -1
- package/docs/demo/assets/index.9331038f.css +0 -1
- package/docs/demo/assets/index.ca7c5881.js +0 -1
- package/docs/demo/assets/main.c164d1d2.js +0 -1
- package/docs/demo/assets/react.2ee8565f.css +0 -1
- package/docs/demo/assets/react.a4774aef.js +0 -25
- package/docs/demo/assets/znRoyv06SZQeqA7m.0057e8ae.js +0 -1
- package/docs/demo/examples.html +0 -17
- package/docs/demo/index-react-dynamic.html +0 -20
- package/docs/demo/index-react.html +0 -20
- package/docs/demo/index.html +0 -19
- package/docs/enums/Player.InfoPanelStyleEnum.html +0 -1
- package/docs/enums/Player.InfoPanelTypeEnum.html +0 -3
- package/docs/enums/Player.PanoEffectEnum.html +0 -5
- package/docs/enums/Player.PanoTagEnum.html +0 -3
- package/docs/enums/Player.PanoTagStyleEnum.html +0 -7
- package/docs/enums/Player.VreoKeyframeEnum.html +0 -25
- package/docs/enums/fivePlugins.CameraMovementEffect.html +0 -1
- package/docs/enums/fivePlugins.Rotation.html +0 -1
- package/docs/index.html +0 -245
- package/docs/interfaces/Player.CustomVreoKeyframeProps.html +0 -1
- package/docs/interfaces/Player.PlayerConfigs.html +0 -7
- package/docs/interfaces/Player.Vertex.html +0 -3
- package/docs/interfaces/Player.VideoAgentMeshOptions.html +0 -8
- package/docs/interfaces/Player.VreoKeyframe.html +0 -3
- package/docs/interfaces/Player.VreoUnit.html +0 -3
- package/docs/interfaces/Player.VreoVideo.html +0 -3
- package/docs/interfaces/fivePlugins.CSS3DRenderPluginExportType.html +0 -4
- package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +0 -1
- package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +0 -7
- package/docs/interfaces/fivePlugins.CameraMovementPluginParameterType.html +0 -1
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +0 -1
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +0 -1
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +0 -1
- package/docs/interfaces/fivePlugins.Vector3Position.html +0 -3
- package/docs/interfaces/react.VreoActionCallbacks.html +0 -23
- package/docs/interfaces/react.VreoProviderProps.html +0 -1
- package/docs/modules/Player.html +0 -37
- package/docs/modules/custom.html +0 -3
- package/docs/modules/fivePlugins.html +0 -6
- package/docs/modules/react.html +0 -1
- package/docs/modules.html +0 -1
- package/resources/PlayController/createHTMLAudioElement.ts +0 -53
- package/resources/PlayController/index.ts +0 -154
- package/resources/Player/App.tsx +0 -66
- package/resources/Player/Controller.ts +0 -294
- package/resources/Player/custom/SpatialScenePanel/index.tsx +0 -264
- package/resources/Player/hooks.ts +0 -26
- package/resources/Player/index.tsx +0 -227
- package/resources/Player/modules/Drawer/index.tsx +0 -40
- package/resources/Player/modules/PopUp/index.tsx +0 -26
- package/resources/Player/modules/ResizeObserver/index.tsx +0 -23
- package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +0 -302
- package/resources/Player/modules/VideoAgent/VideoAgentScene.ts +0 -56
- package/resources/Player/modules/VideoAgent/index.tsx +0 -53
- package/resources/Player/modules/Wave/index.tsx +0 -18
- package/resources/Player/modules/keyframes/BgMusic/index.tsx +0 -66
- package/resources/Player/modules/keyframes/CameraMovement/index.tsx +0 -37
- package/resources/Player/modules/keyframes/InfoPanel/index.tsx +0 -165
- package/resources/Player/modules/keyframes/ModelVideo/index.tsx +0 -77
- package/resources/Player/modules/keyframes/PanoEffect/index.tsx +0 -99
- package/resources/Player/modules/keyframes/PanoEffect/lineAnime.ts +0 -31
- package/resources/Player/modules/keyframes/PanoTag/index.tsx +0 -82
- package/resources/Player/modules/keyframes/PanoTextLabel/index.tsx +0 -117
- package/resources/Player/modules/keyframes/Prompter/index.tsx +0 -56
- package/resources/Player/modules/keyframes/UpdateVRPanorama/index.tsx +0 -99
- package/resources/Player/modules/keyframes/VideoEffect/index.tsx +0 -115
- package/resources/Player/typings.ts +0 -49
- package/resources/fivePlugins/CSS3DRenderPlugin/centerPoint.ts +0 -5
- package/resources/fivePlugins/CSS3DRenderPlugin/createResizeObserver.ts +0 -17
- package/resources/fivePlugins/CSS3DRenderPlugin/evenNumber.ts +0 -4
- package/resources/fivePlugins/CSS3DRenderPlugin/index.ts +0 -254
- package/resources/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.ts +0 -5
- package/resources/fivePlugins/CameraMovementPlugin/index.ts +0 -226
- package/resources/fivePlugins/CameraMovementPlugin/typings.ts +0 -59
- package/resources/fivePlugins/ModelTVVideoPlugin/index.ts +0 -278
- package/resources/index.ts +0 -1
- package/resources/react/index.tsx +0 -121
- package/resources/shared-utils/AduioLike.ts +0 -109
- package/resources/shared-utils/Preloader.ts +0 -35
- package/resources/shared-utils/addResizeListener.ts +0 -46
- package/resources/shared-utils/animationFrame/BetterTween.ts +0 -33
- package/resources/shared-utils/animationFrame/index.ts +0 -48
- package/resources/shared-utils/animationFrame/tween.ts +0 -51
- package/resources/shared-utils/createTransMatrix.ts +0 -12
- package/resources/shared-utils/getFileExpandedName.ts +0 -6
- package/resources/shared-utils/getMediaInfo.ts +0 -52
- package/resources/shared-utils/setElementDataset.ts +0 -18
- package/resources/typings/VreoUnit.ts +0 -314
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import { ReactNode } from 'react'
|
|
3
|
-
import {
|
|
4
|
-
InfoPanelData,
|
|
5
|
-
InfoPanelStyleEnum,
|
|
6
|
-
InfoPanelTypeEnum,
|
|
7
|
-
VreoKeyframe,
|
|
8
|
-
VreoKeyframeEnum,
|
|
9
|
-
} from '../../../../typings/VreoUnit'
|
|
10
|
-
import { useController } from '../../../hooks'
|
|
11
|
-
|
|
12
|
-
function InfoPanelImg({ url, children }: { url: string; children?: ReactNode }) {
|
|
13
|
-
return (
|
|
14
|
-
<div className="vreo-infoPanel-container">
|
|
15
|
-
<div className="vreo-infoPanel vreo-infoPanel--img">
|
|
16
|
-
<div className="ratio-4-5 vreo-infoPanel-wrapper">
|
|
17
|
-
<div className="vreo-infoPanel-inner">
|
|
18
|
-
{children}
|
|
19
|
-
<img className="vreo-infoPanelImg" src={url}></img>
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
23
|
-
</div>
|
|
24
|
-
)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function InfoPanelVideo({ url, children }: { url: string; children?: ReactNode }) {
|
|
28
|
-
return (
|
|
29
|
-
<div className="vreo-infoPanel-container">
|
|
30
|
-
<div className="vreo-infoPanel vreo-infoPanel--video">
|
|
31
|
-
<div className="ratio-4-5 vreo-infoPanel-wrapper">
|
|
32
|
-
<div className="vreo-infoPanel-inner">
|
|
33
|
-
{children}
|
|
34
|
-
<div className="vreo-infoPanelVideo">
|
|
35
|
-
<video playsInline autoPlay className="vreo-infoPanelVideo" src={url} />
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
interface TitleProps {
|
|
45
|
-
title?: string
|
|
46
|
-
subTitle?: string
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const Title = (props: TitleProps) => {
|
|
50
|
-
if (!props.title && !props.subTitle) {
|
|
51
|
-
return null
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<>
|
|
56
|
-
<div className="vreo-infoPanel-title-shadow"></div>
|
|
57
|
-
<div className="vreo-infoPanel-title">
|
|
58
|
-
<div className="vreo-infoPanel-t1">{props.title}</div>
|
|
59
|
-
<div className="vreo-infoPanel-t2">{props.subTitle}</div>
|
|
60
|
-
</div>
|
|
61
|
-
</>
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export function InfoPanel() {
|
|
66
|
-
const timeoutRef = React.useRef<NodeJS.Timeout | null>()
|
|
67
|
-
const controller = useController()
|
|
68
|
-
|
|
69
|
-
React.useEffect(() => {
|
|
70
|
-
if (controller.configs?.keyframeMap.InfoPanel === false) {
|
|
71
|
-
return
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const callback = (keyframe: VreoKeyframe) => {
|
|
75
|
-
const { start, end, data } = keyframe
|
|
76
|
-
|
|
77
|
-
const infoPanelData = data as InfoPanelData
|
|
78
|
-
|
|
79
|
-
const { title, subTitle, style } = infoPanelData
|
|
80
|
-
do {
|
|
81
|
-
if (style === InfoPanelStyleEnum.PopUp) {
|
|
82
|
-
if (infoPanelData.type === InfoPanelTypeEnum.Image) {
|
|
83
|
-
controller.openPopUp(
|
|
84
|
-
<InfoPanelImg url={infoPanelData.url}>
|
|
85
|
-
<Title title={title} subTitle={subTitle} />
|
|
86
|
-
</InfoPanelImg>
|
|
87
|
-
)
|
|
88
|
-
} else if (infoPanelData.type === InfoPanelTypeEnum.Video) {
|
|
89
|
-
controller.openPopUp(
|
|
90
|
-
<InfoPanelVideo url={infoPanelData.url}>
|
|
91
|
-
<Title title={title} subTitle={subTitle} />
|
|
92
|
-
</InfoPanelVideo>
|
|
93
|
-
)
|
|
94
|
-
}
|
|
95
|
-
break
|
|
96
|
-
}
|
|
97
|
-
if (infoPanelData.type === InfoPanelTypeEnum.Image) {
|
|
98
|
-
controller.openDrawer({
|
|
99
|
-
content: (
|
|
100
|
-
<InfoPanelImg url={infoPanelData.url}>
|
|
101
|
-
<Title title={title} subTitle={subTitle} />
|
|
102
|
-
</InfoPanelImg>
|
|
103
|
-
),
|
|
104
|
-
height: '60vh',
|
|
105
|
-
})
|
|
106
|
-
} else if (infoPanelData.type === InfoPanelTypeEnum.Video) {
|
|
107
|
-
controller.openDrawer({
|
|
108
|
-
content: (
|
|
109
|
-
<InfoPanelVideo url={infoPanelData.url}>
|
|
110
|
-
<Title title={title} subTitle={subTitle} />
|
|
111
|
-
</InfoPanelVideo>
|
|
112
|
-
),
|
|
113
|
-
height: '60vh',
|
|
114
|
-
})
|
|
115
|
-
}
|
|
116
|
-
} while (false)
|
|
117
|
-
|
|
118
|
-
timeoutRef.current = setTimeout(() => {
|
|
119
|
-
controller.openDrawer(false)
|
|
120
|
-
controller.openPopUp(false)
|
|
121
|
-
}, end - start)
|
|
122
|
-
}
|
|
123
|
-
controller.on(VreoKeyframeEnum.InfoPanel, callback)
|
|
124
|
-
|
|
125
|
-
// Object.assign(window, {
|
|
126
|
-
// $setInfoPanel: () => {
|
|
127
|
-
// controller.openPopUp(
|
|
128
|
-
// // <InfoPanelImg url='//vrlab-static.ljcdn.com/release/web/psq/a.8e868cb2.gif' />
|
|
129
|
-
// // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/web/psq/b.f9a1ed52.png' />
|
|
130
|
-
// // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/web/psq/c.4f88c112.png' />
|
|
131
|
-
// // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/seesay/tools/cat_music___f68fb9bbe1f7cd6d00a16456dd0b09ad.gif' />
|
|
132
|
-
// <InfoPanelImg url="http://vrlab-public.ljcdn.com/common/images/web/d94e1bd7-0311-4b20-9c41-a1294fe43554.png">
|
|
133
|
-
// <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
|
|
134
|
-
// </InfoPanelImg>
|
|
135
|
-
// // <InfoPanelVideo url="//vrlab-public.ljcdn.com/release/seesay/tools/2022011713142___b320f74a5e1b5ad4bb46b4dc69d73ecc.mp4">
|
|
136
|
-
// // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
|
|
137
|
-
// // </InfoPanelVideo>
|
|
138
|
-
// )
|
|
139
|
-
// },
|
|
140
|
-
// $setInfoPanel2: () => {
|
|
141
|
-
// controller.openPopUp(
|
|
142
|
-
// <InfoPanelImg url='//vrlab-static.ljcdn.com/release/web/psq/a.8e868cb2.gif' />
|
|
143
|
-
// // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/web/psq/b.f9a1ed52.png' />
|
|
144
|
-
// // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/web/psq/c.4f88c112.png' />
|
|
145
|
-
// // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/seesay/tools/cat_music___f68fb9bbe1f7cd6d00a16456dd0b09ad.gif' />
|
|
146
|
-
// // <InfoPanelImg url="http://vrlab-public.ljcdn.com/common/images/web/d94e1bd7-0311-4b20-9c41-a1294fe43554.png">
|
|
147
|
-
// // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
|
|
148
|
-
// // </InfoPanelImg>
|
|
149
|
-
// // <InfoPanelVideo url="//vrlab-public.ljcdn.com/release/seesay/tools/2022011713142___b320f74a5e1b5ad4bb46b4dc69d73ecc.mp4">
|
|
150
|
-
// // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
|
|
151
|
-
// // </InfoPanelVideo>
|
|
152
|
-
// )
|
|
153
|
-
// },
|
|
154
|
-
// })
|
|
155
|
-
|
|
156
|
-
return () => {
|
|
157
|
-
controller.off(VreoKeyframeEnum.InfoPanel, callback)
|
|
158
|
-
if (timeoutRef.current) {
|
|
159
|
-
clearTimeout(timeoutRef.current)
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}, [controller])
|
|
163
|
-
|
|
164
|
-
return <></>
|
|
165
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import * as THREE from 'three'
|
|
3
|
-
import { useController, useFiveInstance } from '../../../hooks'
|
|
4
|
-
import { ModelTVVideoPlugin } from '../../../../fivePlugins/ModelTVVideoPlugin'
|
|
5
|
-
import { createTransMatrix } from '../../../../shared-utils/createTransMatrix'
|
|
6
|
-
import { ModelVideoData, VreoKeyframe, VreoKeyframeEnum } from '../../../../typings/VreoUnit'
|
|
7
|
-
|
|
8
|
-
export function ModelVideo() {
|
|
9
|
-
const controller = useController()
|
|
10
|
-
const five = useFiveInstance()
|
|
11
|
-
const ref = React.useRef<ReturnType<typeof ModelTVVideoPlugin>>()
|
|
12
|
-
const timeoutRef = React.useRef<NodeJS.Timeout | null>()
|
|
13
|
-
|
|
14
|
-
React.useEffect(() => {
|
|
15
|
-
const callback = async (keyframe: VreoKeyframe) => {
|
|
16
|
-
if (!ref.current) {
|
|
17
|
-
ref.current = ModelTVVideoPlugin(five, {})
|
|
18
|
-
}
|
|
19
|
-
const { start, end } = keyframe
|
|
20
|
-
const { videoSrc, videoPosterSrc, vertexs, matrixWorld } = keyframe.data as ModelVideoData
|
|
21
|
-
|
|
22
|
-
const position = (() => {
|
|
23
|
-
if (vertexs.length < 4) {
|
|
24
|
-
throw new Error('ModelVideo: 顶点数据集合不够,无法组成矩形 ....')
|
|
25
|
-
}
|
|
26
|
-
if (vertexs.length === 4) {
|
|
27
|
-
return vertexs
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const box = new THREE.Box3()
|
|
31
|
-
vertexs.forEach((v) => box.expandByPoint(new THREE.Vector3(v.x, v.y, v.z)))
|
|
32
|
-
return [
|
|
33
|
-
new THREE.Vector3(box.min.x, box.max.y, box.max.z),
|
|
34
|
-
new THREE.Vector3(box.min.x, box.min.y, box.max.z),
|
|
35
|
-
new THREE.Vector3(box.max.x, box.min.y, box.max.z),
|
|
36
|
-
new THREE.Vector3(box.max.x, box.max.y, box.max.z),
|
|
37
|
-
]
|
|
38
|
-
})()
|
|
39
|
-
|
|
40
|
-
const points = (() => {
|
|
41
|
-
if (matrixWorld) {
|
|
42
|
-
const transMatrix = createTransMatrix(matrixWorld)
|
|
43
|
-
return [
|
|
44
|
-
position.map((p) => {
|
|
45
|
-
const res = transMatrix([p.x, p.y, p.z])
|
|
46
|
-
return { x: res[0], y: res[1], z: res[2] }
|
|
47
|
-
}),
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
return [position]
|
|
51
|
-
})()
|
|
52
|
-
|
|
53
|
-
ref.current.disable()
|
|
54
|
-
await ref.current.load(
|
|
55
|
-
{
|
|
56
|
-
video_src: videoSrc,
|
|
57
|
-
video_poster_src: videoPosterSrc,
|
|
58
|
-
points,
|
|
59
|
-
},
|
|
60
|
-
controller.configs?.videos?.modelTVVideo
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
ref.current.enable()
|
|
64
|
-
timeoutRef.current = setTimeout(() => ref.current?.disable(), end - start)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
controller.on(VreoKeyframeEnum.ModelVideo, callback)
|
|
68
|
-
return () => {
|
|
69
|
-
controller.off(VreoKeyframeEnum.ModelVideo, callback)
|
|
70
|
-
if (timeoutRef.current) {
|
|
71
|
-
clearTimeout(timeoutRef.current)
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}, [controller])
|
|
75
|
-
|
|
76
|
-
return <></>
|
|
77
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import { Vector3 } from 'three'
|
|
3
|
-
import classNames from 'classnames'
|
|
4
|
-
|
|
5
|
-
import lineAnime from './lineAnime'
|
|
6
|
-
import { useController, useFiveInstance, useFiveProject2d } from '../../../hooks'
|
|
7
|
-
import { BetterTween } from '../../../../shared-utils/animationFrame/BetterTween'
|
|
8
|
-
import { PanoEffectData, VreoKeyframe, VreoKeyframeEnum } from '../../../../typings/VreoUnit'
|
|
9
|
-
|
|
10
|
-
export function PanoEffect() {
|
|
11
|
-
const [state, setState] = React.useState<{
|
|
12
|
-
center: Vector3
|
|
13
|
-
distance: number
|
|
14
|
-
} | null>(null)
|
|
15
|
-
|
|
16
|
-
const five = useFiveInstance()
|
|
17
|
-
const lineRef = React.useRef<BetterTween<{ progress: number }> | null>(null)
|
|
18
|
-
const [pos, setPos] = React.useState<{ left: number; top: number } | null>(null)
|
|
19
|
-
const timeoutRef = React.useRef<NodeJS.Timeout | null>()
|
|
20
|
-
|
|
21
|
-
const controller = useController()
|
|
22
|
-
const project2d = useFiveProject2d()
|
|
23
|
-
|
|
24
|
-
const delLine = () => {
|
|
25
|
-
if (lineRef.current) {
|
|
26
|
-
lineRef.current.dispose()
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
React.useEffect(() => {
|
|
31
|
-
const callback = (keyframe: VreoKeyframe) => {
|
|
32
|
-
const { start, end, data } = keyframe
|
|
33
|
-
|
|
34
|
-
const videoEffectData = data as PanoEffectData
|
|
35
|
-
|
|
36
|
-
const [v1, v2] = videoEffectData.twoVertexs
|
|
37
|
-
const p1 = new Vector3(v1.x, v1.y, v1.z)
|
|
38
|
-
const p2 = new Vector3(v2.x, v2.y, v2.z)
|
|
39
|
-
|
|
40
|
-
lineRef.current = lineAnime(five, p1.clone(), p2.clone())
|
|
41
|
-
lineRef.current.play()
|
|
42
|
-
|
|
43
|
-
const center = p1.lerp(p2, 0.5)
|
|
44
|
-
const distance = p1.distanceTo(p2)
|
|
45
|
-
|
|
46
|
-
const p = project2d(center)
|
|
47
|
-
if (!p) return
|
|
48
|
-
const { x: left, y: top } = p
|
|
49
|
-
setState({ center, distance })
|
|
50
|
-
setPos({ left, top })
|
|
51
|
-
timeoutRef.current = setTimeout(() => {
|
|
52
|
-
setState(null)
|
|
53
|
-
setPos(null)
|
|
54
|
-
delLine()
|
|
55
|
-
}, end - start)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
controller.on(VreoKeyframeEnum.PanoEffect, callback)
|
|
59
|
-
|
|
60
|
-
return () => {
|
|
61
|
-
controller.off(VreoKeyframeEnum.PanoEffect, callback)
|
|
62
|
-
if (timeoutRef.current) {
|
|
63
|
-
clearTimeout(timeoutRef.current)
|
|
64
|
-
}
|
|
65
|
-
delLine()
|
|
66
|
-
}
|
|
67
|
-
}, [controller])
|
|
68
|
-
|
|
69
|
-
React.useEffect(() => {
|
|
70
|
-
const callback = () => {
|
|
71
|
-
if (!state?.center) return
|
|
72
|
-
const { x, y, z } = state.center
|
|
73
|
-
const res = project2d(new Vector3(x, y, z))
|
|
74
|
-
if (!res) return
|
|
75
|
-
const { x: left, y: top } = res
|
|
76
|
-
setPos({ left, top })
|
|
77
|
-
}
|
|
78
|
-
five.on('currentStateChange', callback)
|
|
79
|
-
return () => {
|
|
80
|
-
five.off('currentStateChange', callback)
|
|
81
|
-
}
|
|
82
|
-
}, [state?.center])
|
|
83
|
-
|
|
84
|
-
return (
|
|
85
|
-
<>
|
|
86
|
-
<div
|
|
87
|
-
className={classNames('PanoEffect', {
|
|
88
|
-
'PanoEffect--notHidden': state,
|
|
89
|
-
})}
|
|
90
|
-
style={{
|
|
91
|
-
left: (pos?.left || 0) + 'px',
|
|
92
|
-
top: (pos?.top || 0) + 'px',
|
|
93
|
-
}}
|
|
94
|
-
>
|
|
95
|
-
{state?.distance.toFixed(4) + 'm'}
|
|
96
|
-
</div>
|
|
97
|
-
</>
|
|
98
|
-
)
|
|
99
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three'
|
|
2
|
-
import { Five } from '@realsee/five'
|
|
3
|
-
import { Line as FiveLine } from '@realsee/five/line'
|
|
4
|
-
import { tweenProgress } from '../../../../shared-utils/animationFrame/BetterTween'
|
|
5
|
-
|
|
6
|
-
export default function lineAnime(five: Five, startPoint: THREE.Vector3, endPoint: THREE.Vector3) {
|
|
7
|
-
const pointImage =
|
|
8
|
-
'data:image/png;base64,' +
|
|
9
|
-
'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAIVBMVEUAAAD////////////////////////////////////////PIev5AAAACnRSTlMAG/Py2baba05un7UgfgAAAHJJREFUKM9joBpgLHVSCRdA4metAoJlCJHmVWBgAeNzroKCCVCBLpjACqgJVjCBxRBT2FbBQQJYQAohsBAsUIUQWA4WiEIILAULeCEEloAFtBACizAEMLRgGIphLabDMJ2O6TlM72MGECIIMQIZIxqoBQCPvpJ/e9FaAAAAAABJRU5ErkJggg=='
|
|
10
|
-
const pointTexture = new THREE.TextureLoader().load(pointImage)
|
|
11
|
-
const color = new THREE.Color(0xffffff) as any
|
|
12
|
-
const line = new FiveLine()
|
|
13
|
-
line.setMaterial({ linewidth: 2, color })
|
|
14
|
-
const pointMaterial = line.points.material as THREE.PointsMaterial
|
|
15
|
-
pointMaterial.map = pointTexture
|
|
16
|
-
pointMaterial.color.set(color)
|
|
17
|
-
line.line.material.depthTest = false
|
|
18
|
-
return tweenProgress()
|
|
19
|
-
.onUpdate(({ progress }) => {
|
|
20
|
-
const lerpLeft = 0.5 - progress / 2
|
|
21
|
-
const lerpRight = 0.5 + progress / 2
|
|
22
|
-
const leftPoint = startPoint.clone().lerp(endPoint, lerpLeft)
|
|
23
|
-
const rightPoint = startPoint.clone().lerp(endPoint, lerpRight)
|
|
24
|
-
line.setPoints(leftPoint, rightPoint)
|
|
25
|
-
})
|
|
26
|
-
.onStart(() => five.scene.add(line))
|
|
27
|
-
.onDispose(() => {
|
|
28
|
-
five.scene.remove(line)
|
|
29
|
-
five.needsRender = true
|
|
30
|
-
})
|
|
31
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import { useController, useFiveInstance } from '../../../hooks'
|
|
3
|
-
import { PanoTagData, VreoKeyframe, VreoKeyframeEnum } from '../../../../typings/VreoUnit'
|
|
4
|
-
|
|
5
|
-
import { ContentType, DimensionType, PanoTagPlugin, PointType, Tag } from '@realsee/dnalogel'
|
|
6
|
-
|
|
7
|
-
export function PanoTag() {
|
|
8
|
-
const timeoutRef = React.useRef<NodeJS.Timeout | null>()
|
|
9
|
-
const controller = useController()
|
|
10
|
-
const five = useFiveInstance()
|
|
11
|
-
const panoTagPlugin = React.useRef(PanoTagPlugin(five as any, {
|
|
12
|
-
config: {
|
|
13
|
-
globalConfig: {
|
|
14
|
-
visibleConfig: {
|
|
15
|
-
keep: 'visible'
|
|
16
|
-
},
|
|
17
|
-
unfoldedConfig: {
|
|
18
|
-
autoUnfold: {
|
|
19
|
-
strategy: 'MinimumDistance'
|
|
20
|
-
},
|
|
21
|
-
unfoldDistance: { max: 100 }
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}))
|
|
26
|
-
|
|
27
|
-
React.useEffect(() => {
|
|
28
|
-
if (controller.configs?.keyframeMap.PanoTag === false) {
|
|
29
|
-
return
|
|
30
|
-
}
|
|
31
|
-
const callback = (keyframe: VreoKeyframe) => {
|
|
32
|
-
if (!panoTagPlugin.current) return
|
|
33
|
-
|
|
34
|
-
const { start, end, data } = keyframe
|
|
35
|
-
|
|
36
|
-
const panoTagData = data as PanoTagData
|
|
37
|
-
|
|
38
|
-
const id = Date.now().toString()
|
|
39
|
-
const pointType = PointType.PointTag
|
|
40
|
-
const dimensionType = DimensionType.Two
|
|
41
|
-
const position = [panoTagData.vertex.x, panoTagData.vertex.y, panoTagData.vertex.z]
|
|
42
|
-
const tag: Tag = (() => {
|
|
43
|
-
if (panoTagData.imgUrl) {
|
|
44
|
-
return { id, pointType, position, dimensionType, contentType: ContentType.ImageText, data: { text: panoTagData.text, mediaData: [{ type: 'Image', url: panoTagData.imgUrl }] }}
|
|
45
|
-
} else {
|
|
46
|
-
return { id, pointType, position, dimensionType, contentType: ContentType.Text, data: { text: panoTagData.text }}
|
|
47
|
-
}
|
|
48
|
-
})()
|
|
49
|
-
|
|
50
|
-
// show
|
|
51
|
-
panoTagPlugin.current.load({ tagList: [tag] })
|
|
52
|
-
|
|
53
|
-
timeoutRef.current = setTimeout(() => {
|
|
54
|
-
// clear
|
|
55
|
-
const tag = panoTagPlugin.current.getTagById(id)
|
|
56
|
-
if (tag.state) {
|
|
57
|
-
tag.state.unfolded = false
|
|
58
|
-
;(panoTagPlugin.current as any).updateRenderAllTags()
|
|
59
|
-
}
|
|
60
|
-
tag.hooks?.on('folded', () => {
|
|
61
|
-
setTimeout(() => {
|
|
62
|
-
if (tag.state) {
|
|
63
|
-
tag.state.visible = false
|
|
64
|
-
panoTagPlugin.current.destroyTagById(id)
|
|
65
|
-
}
|
|
66
|
-
}, 1500)
|
|
67
|
-
})
|
|
68
|
-
}, end - start)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
controller.on(VreoKeyframeEnum.PanoTag, callback)
|
|
72
|
-
|
|
73
|
-
return () => {
|
|
74
|
-
controller.off(VreoKeyframeEnum.PanoTag, callback)
|
|
75
|
-
if (timeoutRef.current) {
|
|
76
|
-
clearTimeout(timeoutRef.current)
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}, [controller])
|
|
80
|
-
|
|
81
|
-
return null
|
|
82
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import * as THREE from 'three'
|
|
3
|
-
import ReactDOM from 'react-dom'
|
|
4
|
-
import { Vector3, Quaternion } from 'three'
|
|
5
|
-
|
|
6
|
-
import { useController, useFiveInstance } from '../../../hooks'
|
|
7
|
-
import { CSS3DRenderPlugin } from '../../../../fivePlugins/CSS3DRenderPlugin'
|
|
8
|
-
import { PanoTextLabelData, VreoKeyframe, VreoKeyframeEnum } from '../../../../typings/VreoUnit'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* 通过传入中心点确定矩形框架容器的四个点:
|
|
12
|
-
* 1. 已知矩形长宽和中心点
|
|
13
|
-
* 2. 借助planeGeometry生成垂直相机视角的平面上的四个点
|
|
14
|
-
* 3. 通过向量相加,平行四边形法则获取到移动position后的面上四个点
|
|
15
|
-
*/
|
|
16
|
-
const calcPoints = (
|
|
17
|
-
centerPoint: Vector3,
|
|
18
|
-
normal: THREE.Vector3 | undefined,
|
|
19
|
-
wrapperLength: number,
|
|
20
|
-
wrapperWidth: number
|
|
21
|
-
) => {
|
|
22
|
-
// 375px 对应 1m
|
|
23
|
-
const length = wrapperLength / 375
|
|
24
|
-
const width = wrapperWidth / 375
|
|
25
|
-
|
|
26
|
-
const geometry = new THREE.PlaneGeometry(length, width)
|
|
27
|
-
if (normal) {
|
|
28
|
-
const lookPoint = new THREE.Vector3(normal.x + centerPoint.x, normal.y + centerPoint.y, normal.z + centerPoint.z)
|
|
29
|
-
geometry.lookAt(lookPoint)
|
|
30
|
-
}
|
|
31
|
-
// const pointgeometry = new THREE.Geometry()
|
|
32
|
-
// pointgeometry.vertices.push(cameraPosition)
|
|
33
|
-
// const pointmaterial = new THREE.PointsMaterial({
|
|
34
|
-
// color: 0xffffff,
|
|
35
|
-
// size: 0.4,
|
|
36
|
-
// })
|
|
37
|
-
// _point = new THREE.Points(pointgeometry, pointmaterial)
|
|
38
|
-
|
|
39
|
-
const material = new THREE.MeshBasicMaterial({ color: 0xffff00, side: THREE.DoubleSide })
|
|
40
|
-
const plane = new THREE.Mesh(geometry, material)
|
|
41
|
-
const v0 = centerPoint.clone()
|
|
42
|
-
plane.position.copy(v0)
|
|
43
|
-
|
|
44
|
-
// 计算传入的四个点的坐标
|
|
45
|
-
const [v1, v2, v3, v4] = plane.geometry.vertices
|
|
46
|
-
const downLeft = v0.clone().add(v4)
|
|
47
|
-
const downRight = v0.clone().add(v3)
|
|
48
|
-
const upLeft = v0.clone().add(v2)
|
|
49
|
-
const upRight = v0.clone().add(v1)
|
|
50
|
-
|
|
51
|
-
// 插件使用要求:矩形四个点位数据,顺序为**必须**为左下、右下、右上、左上
|
|
52
|
-
return [downLeft, downRight, upRight, upLeft]
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* 空间文本标签。
|
|
57
|
-
*/
|
|
58
|
-
export function PanoTextLabel() {
|
|
59
|
-
const timeoutRef = React.useRef<NodeJS.Timeout | null>()
|
|
60
|
-
const controller = useController()
|
|
61
|
-
const five = useFiveInstance()
|
|
62
|
-
const ref = React.useRef<ReturnType<typeof CSS3DRenderPlugin>>()
|
|
63
|
-
|
|
64
|
-
React.useEffect(() => {
|
|
65
|
-
if (controller.configs?.keyframeMap.PanoTextLabel === false) {
|
|
66
|
-
return
|
|
67
|
-
}
|
|
68
|
-
const callback = (keyframe: VreoKeyframe) => {
|
|
69
|
-
const { start, end, data } = keyframe
|
|
70
|
-
const panoTextLabelData = data as PanoTextLabelData
|
|
71
|
-
// 增加无文本情况的判断
|
|
72
|
-
if (data.text === '') return
|
|
73
|
-
|
|
74
|
-
const { x, y, z } = panoTextLabelData.vertex
|
|
75
|
-
const centerPoint = new Vector3(x, y, z)
|
|
76
|
-
const normal = new Vector3(panoTextLabelData.normal?.x, panoTextLabelData.normal?.y, panoTextLabelData.normal?.z)
|
|
77
|
-
// 生成传入的四个点,将文本框最大宽度定在200px,最高高度在30px
|
|
78
|
-
const wrapperLength = 200
|
|
79
|
-
const wrapperWidth = 30
|
|
80
|
-
const points = calcPoints(centerPoint, panoTextLabelData.normal && normal, wrapperLength, wrapperWidth)
|
|
81
|
-
|
|
82
|
-
if (!ref.current) ref.current = CSS3DRenderPlugin(five)
|
|
83
|
-
const container = ref.current.create3DDomContainer(points)
|
|
84
|
-
const css3DObject = container?.css3DObject
|
|
85
|
-
// 将获取的mesh进行旋转操作,根据欧拉角去进行mesh的变换
|
|
86
|
-
if (data.quaternion) {
|
|
87
|
-
const quaternion = new Quaternion(data.quaternion.x, data.quaternion.y, data.quaternion.z, data.quaternion.w)
|
|
88
|
-
css3DObject?.quaternion.copy(quaternion)
|
|
89
|
-
}
|
|
90
|
-
if (container?.container)
|
|
91
|
-
ReactDOM.render(
|
|
92
|
-
<div className="PanoTextLabel PanoTextLabel--notHidden">
|
|
93
|
-
<div className="PanoTextLabel-wrapper">
|
|
94
|
-
<div style={{ fontSize: `${data.fontSize || 16}px` }} className="PanoText-innerText">
|
|
95
|
-
{data.text || ''}
|
|
96
|
-
</div>
|
|
97
|
-
</div>
|
|
98
|
-
</div>,
|
|
99
|
-
container?.container
|
|
100
|
-
)
|
|
101
|
-
|
|
102
|
-
timeoutRef.current = setTimeout(() => {
|
|
103
|
-
ref.current?.disposeAll()
|
|
104
|
-
}, end - start)
|
|
105
|
-
}
|
|
106
|
-
controller.on(VreoKeyframeEnum.PanoTextLabel, callback)
|
|
107
|
-
|
|
108
|
-
return () => {
|
|
109
|
-
controller.off(VreoKeyframeEnum.PanoTextLabel, callback)
|
|
110
|
-
if (timeoutRef.current) {
|
|
111
|
-
clearTimeout(timeoutRef.current)
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}, [controller])
|
|
115
|
-
|
|
116
|
-
return <></>
|
|
117
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import classNames from 'classnames'
|
|
3
|
-
import { useController } from '../../../hooks'
|
|
4
|
-
|
|
5
|
-
import { VreoKeyframe, VreoKeyframeEnum } from '../../../../typings/VreoUnit'
|
|
6
|
-
|
|
7
|
-
export function Prompter() {
|
|
8
|
-
const [text, setText] = React.useState<string>('')
|
|
9
|
-
const [hidden, setHidden] = React.useState<boolean>(true)
|
|
10
|
-
const ref = React.useRef<NodeJS.Timeout | null>(null)
|
|
11
|
-
const controller = useController()
|
|
12
|
-
|
|
13
|
-
React.useEffect(() => {
|
|
14
|
-
if (controller.configs?.keyframeMap.Prompter === false) {
|
|
15
|
-
return
|
|
16
|
-
}
|
|
17
|
-
const callback = (keyframe: VreoKeyframe) => {
|
|
18
|
-
const { start, end, data } = keyframe
|
|
19
|
-
setText(data.text)
|
|
20
|
-
setHidden(false)
|
|
21
|
-
|
|
22
|
-
if (ref.current) {
|
|
23
|
-
clearTimeout(ref.current)
|
|
24
|
-
ref.current = null
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
ref.current = setTimeout(() => {
|
|
28
|
-
setHidden(true)
|
|
29
|
-
setText('')
|
|
30
|
-
// setTimeout(() => setText(''), 500)
|
|
31
|
-
|
|
32
|
-
if (ref.current) clearTimeout(ref.current)
|
|
33
|
-
ref.current = null
|
|
34
|
-
}, end - start)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
controller.on(VreoKeyframeEnum.Prompter, callback)
|
|
38
|
-
|
|
39
|
-
return () => {
|
|
40
|
-
controller.off(VreoKeyframeEnum.Prompter, callback)
|
|
41
|
-
}
|
|
42
|
-
}, [controller])
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<div
|
|
46
|
-
className={classNames('vreo-prompter', {
|
|
47
|
-
'vreo-prompter--hidden': hidden,
|
|
48
|
-
[`vreo-prompter-left--${controller.agentType}`]: true,
|
|
49
|
-
})}
|
|
50
|
-
>
|
|
51
|
-
<div className="vreo-prompter-text">
|
|
52
|
-
<div className="vreo-prompter-innerText">{text}</div>
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
)
|
|
56
|
-
}
|