@zenvor/view360 4.0.0-beta.7-fork.1

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 (261) hide show
  1. package/LICENSE +19 -0
  2. package/README.md +88 -0
  3. package/css/base.css +19 -0
  4. package/css/base.min.css +1 -0
  5. package/css/control-bar.css +329 -0
  6. package/css/control-bar.min.css +1 -0
  7. package/css/helper.css +51 -0
  8. package/css/helper.min.css +1 -0
  9. package/css/hotspot.css +21 -0
  10. package/css/hotspot.min.css +1 -0
  11. package/css/loading-spinner.css +37 -0
  12. package/css/loading-spinner.min.css +1 -0
  13. package/css/variable.css +1 -0
  14. package/css/variable.min.css +0 -0
  15. package/css/view360.css +468 -0
  16. package/css/view360.min.css +1 -0
  17. package/css/vr.css +8 -0
  18. package/css/vr.min.css +1 -0
  19. package/declaration/View360.d.ts +150 -0
  20. package/declaration/cfc/const.d.ts +1 -0
  21. package/declaration/cfc/index.d.ts +4 -0
  22. package/declaration/cfc/utils.d.ts +1 -0
  23. package/declaration/cfc/withMethods.d.ts +2 -0
  24. package/declaration/const/browser.d.ts +71 -0
  25. package/declaration/const/error.d.ts +47 -0
  26. package/declaration/const/external.d.ts +33 -0
  27. package/declaration/const/internal.d.ts +34 -0
  28. package/declaration/control/CameraControl.d.ts +10 -0
  29. package/declaration/control/GyroControl.d.ts +30 -0
  30. package/declaration/control/PanoControl.d.ts +58 -0
  31. package/declaration/control/RotateControl.d.ts +75 -0
  32. package/declaration/control/ZoomControl.d.ts +45 -0
  33. package/declaration/control/index.d.ts +7 -0
  34. package/declaration/control/input/GyroInput.d.ts +46 -0
  35. package/declaration/control/input/KeyboardInput.d.ts +21 -0
  36. package/declaration/control/input/MouseInput.d.ts +16 -0
  37. package/declaration/control/input/PinchInput.d.ts +14 -0
  38. package/declaration/control/input/PointerInput.d.ts +18 -0
  39. package/declaration/control/input/TouchInput.d.ts +21 -0
  40. package/declaration/control/input/WheelInput.d.ts +16 -0
  41. package/declaration/core/AutoResizer.d.ts +13 -0
  42. package/declaration/core/Autoplay.d.ts +54 -0
  43. package/declaration/core/Camera.d.ts +88 -0
  44. package/declaration/core/CameraAnimation.d.ts +25 -0
  45. package/declaration/core/CameraPath.d.ts +55 -0
  46. package/declaration/core/CubeTexturePainter.d.ts +16 -0
  47. package/declaration/core/FrameAnimator.d.ts +13 -0
  48. package/declaration/core/Motion.d.ts +39 -0
  49. package/declaration/core/Object3D.d.ts +21 -0
  50. package/declaration/core/ShaderProgram.d.ts +10 -0
  51. package/declaration/core/TextureLoader.d.ts +26 -0
  52. package/declaration/core/TriangleMesh.d.ts +20 -0
  53. package/declaration/core/VertexArrayObject.d.ts +14 -0
  54. package/declaration/core/VertexData.d.ts +8 -0
  55. package/declaration/core/View360Error.d.ts +5 -0
  56. package/declaration/core/WebGLContext.d.ts +74 -0
  57. package/declaration/core/WebGLRenderer.d.ts +26 -0
  58. package/declaration/core/XRManager.d.ts +33 -0
  59. package/declaration/core/index.d.ts +12 -0
  60. package/declaration/geometry/CubeGeometry.d.ts +9 -0
  61. package/declaration/geometry/CylinderGeometry.d.ts +5 -0
  62. package/declaration/geometry/Geometry.d.ts +8 -0
  63. package/declaration/geometry/PlaneGeometry.d.ts +5 -0
  64. package/declaration/geometry/SphereGeometry.d.ts +5 -0
  65. package/declaration/hotspot/Hotspot.d.ts +7 -0
  66. package/declaration/hotspot/HotspotRenderer.d.ts +17 -0
  67. package/declaration/hotspot/index.d.ts +4 -0
  68. package/declaration/index.cjs.d.ts +3 -0
  69. package/declaration/index.d.ts +11 -0
  70. package/declaration/index.umd.d.ts +2 -0
  71. package/declaration/plugin/ControlBar/AutoHide.d.ts +42 -0
  72. package/declaration/plugin/ControlBar/ControlBar.d.ts +113 -0
  73. package/declaration/plugin/ControlBar/ControlBarItem.d.ts +15 -0
  74. package/declaration/plugin/ControlBar/FullscreenButton.d.ts +19 -0
  75. package/declaration/plugin/ControlBar/GyroButton.d.ts +14 -0
  76. package/declaration/plugin/ControlBar/PieView.d.ts +26 -0
  77. package/declaration/plugin/ControlBar/PlayButton.d.ts +16 -0
  78. package/declaration/plugin/ControlBar/ProgressBar.d.ts +23 -0
  79. package/declaration/plugin/ControlBar/RangeControl.d.ts +27 -0
  80. package/declaration/plugin/ControlBar/VRButton.d.ts +12 -0
  81. package/declaration/plugin/ControlBar/VideoControl.d.ts +11 -0
  82. package/declaration/plugin/ControlBar/VideoTime.d.ts +17 -0
  83. package/declaration/plugin/ControlBar/VolumeControl.d.ts +23 -0
  84. package/declaration/plugin/ControlBar/const.d.ts +41 -0
  85. package/declaration/plugin/ControlBar/index.d.ts +11 -0
  86. package/declaration/plugin/LoadingSpinner/LoadingSpinner.d.ts +22 -0
  87. package/declaration/plugin/View360Plugin.d.ts +6 -0
  88. package/declaration/plugin/index.d.ts +5 -0
  89. package/declaration/projection/CorrectionPass.d.ts +26 -0
  90. package/declaration/projection/CubemapProjection.d.ts +19 -0
  91. package/declaration/projection/CubestripProjection.d.ts +18 -0
  92. package/declaration/projection/CylindricalProjection.d.ts +22 -0
  93. package/declaration/projection/EquiangularProjection.d.ts +13 -0
  94. package/declaration/projection/EquirectProjection.d.ts +15 -0
  95. package/declaration/projection/LittlePlanetProjection.d.ts +21 -0
  96. package/declaration/projection/Projection.d.ts +19 -0
  97. package/declaration/projection/StereoEquiProjection.d.ts +25 -0
  98. package/declaration/projection/WideAngleCorrectionProjection.d.ts +27 -0
  99. package/declaration/projection/WideAngleRealtimeProjection.d.ts +50 -0
  100. package/declaration/projection/index.d.ts +12 -0
  101. package/declaration/texture/Texture.d.ts +18 -0
  102. package/declaration/texture/Texture2D.d.ts +11 -0
  103. package/declaration/texture/TextureCube.d.ts +12 -0
  104. package/declaration/texture/TextureRenderTarget.d.ts +8 -0
  105. package/declaration/texture/TextureVideo.d.ts +11 -0
  106. package/declaration/type/events.d.ts +74 -0
  107. package/declaration/type/external.d.ts +13 -0
  108. package/declaration/type/internal.d.ts +47 -0
  109. package/declaration/type/utils.d.ts +11 -0
  110. package/declaration/uniform/Uniform.d.ts +7 -0
  111. package/declaration/uniform/UniformBoolean.d.ts +7 -0
  112. package/declaration/uniform/UniformCanvasCube.d.ts +12 -0
  113. package/declaration/uniform/UniformFloat.d.ts +7 -0
  114. package/declaration/uniform/UniformInt.d.ts +7 -0
  115. package/declaration/uniform/UniformMatrix.d.ts +8 -0
  116. package/declaration/uniform/UniformTexture2D.d.ts +11 -0
  117. package/declaration/uniform/UniformTextureCube.d.ts +12 -0
  118. package/declaration/uniform/UniformTextureRenderTarget.d.ts +11 -0
  119. package/declaration/uniform/UniformVec2.d.ts +7 -0
  120. package/declaration/uniform/UniformVec3.d.ts +7 -0
  121. package/declaration/uniform/UniformVector4Array.d.ts +7 -0
  122. package/declaration/utils.d.ts +25 -0
  123. package/dist/view360.cjs.js +9392 -0
  124. package/dist/view360.cjs.js.map +1 -0
  125. package/dist/view360.esm.js +9274 -0
  126. package/dist/view360.esm.js.map +1 -0
  127. package/dist/view360.js +9350 -0
  128. package/dist/view360.js.map +1 -0
  129. package/dist/view360.min.js +2 -0
  130. package/dist/view360.min.js.map +1 -0
  131. package/dist/view360.pkgd.js +48537 -0
  132. package/dist/view360.pkgd.js.map +1 -0
  133. package/dist/view360.pkgd.min.js +16 -0
  134. package/dist/view360.pkgd.min.js.map +1 -0
  135. package/package.json +110 -0
  136. package/sass/base.sass +17 -0
  137. package/sass/control-bar.sass +284 -0
  138. package/sass/helper.sass +51 -0
  139. package/sass/hotspot.sass +20 -0
  140. package/sass/loading-spinner.sass +34 -0
  141. package/sass/variable.sass +2 -0
  142. package/sass/view360.sass +6 -0
  143. package/sass/vr.sass +10 -0
  144. package/src/View360.ts +1220 -0
  145. package/src/cfc/const.ts +15 -0
  146. package/src/cfc/index.ts +8 -0
  147. package/src/cfc/utils.ts +12 -0
  148. package/src/cfc/withMethods.ts +40 -0
  149. package/src/const/browser.ts +109 -0
  150. package/src/const/error.ts +83 -0
  151. package/src/const/external.ts +77 -0
  152. package/src/const/internal.ts +53 -0
  153. package/src/control/CameraControl.ts +53 -0
  154. package/src/control/GyroControl.ts +225 -0
  155. package/src/control/PanoControl.ts +434 -0
  156. package/src/control/RotateControl.ts +411 -0
  157. package/src/control/ZoomControl.ts +254 -0
  158. package/src/control/index.ts +24 -0
  159. package/src/control/input/GyroInput.ts +315 -0
  160. package/src/control/input/KeyboardInput.ts +151 -0
  161. package/src/control/input/MouseInput.ts +102 -0
  162. package/src/control/input/PinchInput.ts +101 -0
  163. package/src/control/input/PointerInput.ts +118 -0
  164. package/src/control/input/TouchInput.ts +138 -0
  165. package/src/control/input/WheelInput.ts +89 -0
  166. package/src/core/AutoResizer.ts +92 -0
  167. package/src/core/Autoplay.ts +326 -0
  168. package/src/core/Camera.ts +616 -0
  169. package/src/core/CameraAnimation.ts +110 -0
  170. package/src/core/CameraPath.ts +454 -0
  171. package/src/core/CubeTexturePainter.ts +95 -0
  172. package/src/core/FrameAnimator.ts +69 -0
  173. package/src/core/Motion.ts +205 -0
  174. package/src/core/Object3D.ts +81 -0
  175. package/src/core/ShaderProgram.ts +21 -0
  176. package/src/core/TextureLoader.ts +303 -0
  177. package/src/core/TriangleMesh.ts +54 -0
  178. package/src/core/VertexArrayObject.ts +29 -0
  179. package/src/core/VertexData.ts +23 -0
  180. package/src/core/View360Error.ts +35 -0
  181. package/src/core/WebGLContext.ts +558 -0
  182. package/src/core/WebGLRenderer.ts +205 -0
  183. package/src/core/XRManager.ts +193 -0
  184. package/src/core/index.ts +35 -0
  185. package/src/geometry/CubeGeometry.ts +121 -0
  186. package/src/geometry/CylinderGeometry.ts +49 -0
  187. package/src/geometry/Geometry.ts +23 -0
  188. package/src/geometry/PlaneGeometry.ts +36 -0
  189. package/src/geometry/SphereGeometry.ts +55 -0
  190. package/src/hotspot/Hotspot.ts +32 -0
  191. package/src/hotspot/HotspotRenderer.ts +155 -0
  192. package/src/hotspot/index.ts +11 -0
  193. package/src/index.cjs.ts +13 -0
  194. package/src/index.ts +21 -0
  195. package/src/index.umd.ts +10 -0
  196. package/src/plugin/ControlBar/AutoHide.ts +246 -0
  197. package/src/plugin/ControlBar/ControlBar.ts +564 -0
  198. package/src/plugin/ControlBar/ControlBarItem.ts +84 -0
  199. package/src/plugin/ControlBar/FullscreenButton.ts +145 -0
  200. package/src/plugin/ControlBar/GyroButton.ts +124 -0
  201. package/src/plugin/ControlBar/PieView.ts +195 -0
  202. package/src/plugin/ControlBar/PlayButton.ts +130 -0
  203. package/src/plugin/ControlBar/ProgressBar.ts +175 -0
  204. package/src/plugin/ControlBar/RangeControl.ts +165 -0
  205. package/src/plugin/ControlBar/VRButton.ts +78 -0
  206. package/src/plugin/ControlBar/VideoControl.ts +79 -0
  207. package/src/plugin/ControlBar/VideoTime.ts +120 -0
  208. package/src/plugin/ControlBar/VolumeControl.ts +220 -0
  209. package/src/plugin/ControlBar/const.ts +72 -0
  210. package/src/plugin/ControlBar/index.ts +31 -0
  211. package/src/plugin/LoadingSpinner/LoadingSpinner.ts +116 -0
  212. package/src/plugin/View360Plugin.ts +30 -0
  213. package/src/plugin/index.ts +16 -0
  214. package/src/projection/CorrectionPass.ts +161 -0
  215. package/src/projection/CubemapProjection.ts +92 -0
  216. package/src/projection/CubestripProjection.ts +85 -0
  217. package/src/projection/CylindricalProjection.ts +123 -0
  218. package/src/projection/EquiangularProjection.ts +52 -0
  219. package/src/projection/EquirectProjection.ts +56 -0
  220. package/src/projection/LittlePlanetProjection.ts +82 -0
  221. package/src/projection/Projection.ts +103 -0
  222. package/src/projection/StereoEquiProjection.ts +104 -0
  223. package/src/projection/WideAngleCorrectionProjection.ts +307 -0
  224. package/src/projection/WideAngleRealtimeProjection.ts +653 -0
  225. package/src/projection/index.ts +36 -0
  226. package/src/shader/common.frag +7 -0
  227. package/src/shader/common.vert +12 -0
  228. package/src/shader/correction.frag +110 -0
  229. package/src/shader/cube.frag +8 -0
  230. package/src/shader/cube.vert +12 -0
  231. package/src/shader/eac.frag +40 -0
  232. package/src/shader/fullscreen.vert +7 -0
  233. package/src/shader/little-planet.frag +47 -0
  234. package/src/shader/little-planet.vert +12 -0
  235. package/src/shader/stereoequi.vert +15 -0
  236. package/src/shader/wideangle_realtime.frag +109 -0
  237. package/src/shader/wideangle_realtime.vert +17 -0
  238. package/src/shim.d.ts +9 -0
  239. package/src/texture/Texture.ts +47 -0
  240. package/src/texture/Texture2D.ts +34 -0
  241. package/src/texture/TextureCube.ts +36 -0
  242. package/src/texture/TextureRenderTarget.ts +33 -0
  243. package/src/texture/TextureVideo.ts +56 -0
  244. package/src/type/events.ts +389 -0
  245. package/src/type/external.ts +78 -0
  246. package/src/type/internal.ts +54 -0
  247. package/src/type/utils.ts +27 -0
  248. package/src/types/hls.d.ts +78 -0
  249. package/src/uniform/Uniform.ts +20 -0
  250. package/src/uniform/UniformBoolean.ts +23 -0
  251. package/src/uniform/UniformCanvasCube.ts +44 -0
  252. package/src/uniform/UniformFloat.ts +23 -0
  253. package/src/uniform/UniformInt.ts +25 -0
  254. package/src/uniform/UniformMatrix.ts +24 -0
  255. package/src/uniform/UniformTexture2D.ts +46 -0
  256. package/src/uniform/UniformTextureCube.ts +51 -0
  257. package/src/uniform/UniformTextureRenderTarget.ts +55 -0
  258. package/src/uniform/UniformVec2.ts +25 -0
  259. package/src/uniform/UniformVec3.ts +25 -0
  260. package/src/uniform/UniformVector4Array.ts +23 -0
  261. package/src/utils.ts +217 -0
@@ -0,0 +1,389 @@
1
+ /*
2
+ * Copyright (c) 2023-present NAVER Corp.
3
+ * egjs projects are licensed under the MIT license
4
+ */
5
+ import View360 from "../View360";
6
+ import Projection, { ProjectionOptions } from "../projection/Projection";
7
+
8
+ /**
9
+ * An event that fires when the component is initialized.
10
+ * This will be called once after {@link View360#init init()} is called.
11
+ * @ko 컴포넌트 초기화시 발생하는 이벤트
12
+ * 이 이벤트는 {@link View360#init init()}가 호출된 이후 단 1회만 호출됩니다.
13
+ * @eventName ready
14
+ * @eventOf View360
15
+ * @group Event
16
+ * @since 4.0.0
17
+ */
18
+ export interface ReadyEvent {
19
+ /**
20
+ * A type of the event.
21
+ * This value is equal to event's name.
22
+ * @ko 이벤트 타입.
23
+ * 이벤트 이름과 값이 같습니다.
24
+ * @since 4.0.0
25
+ * @example
26
+ * ```ts
27
+ * viewer.on("ready", evt => {
28
+ * console.log(evt.type); // "ready"
29
+ * });
30
+ * ```
31
+ */
32
+ type: string;
33
+ /**
34
+ * An instance of the component that triggered this event.
35
+ * @ko 이벤트를 발생시킨 컴포넌트의 인스턴스.
36
+ * @since 4.0.0
37
+ * @example
38
+ * ```ts
39
+ * viewer.on("ready", evt => {
40
+ * console.log(evt.target); // = viewer
41
+ * });
42
+ * ```
43
+ */
44
+ target: View360;
45
+ }
46
+
47
+ /**
48
+ * An event that fires before loading the content.
49
+ * @ko 콘텐츠 로드를 시작하기 전에 발생하는 이벤트.
50
+ * @eventName loadStart
51
+ * @eventOf View360
52
+ * @group Event
53
+ * @since 4.0.0
54
+ */
55
+ export interface LoadStartEvent {
56
+ /**
57
+ * @copy ReadyEvent#type
58
+ */
59
+ type: string;
60
+ /**
61
+ * @copy ReadyEvent#target
62
+ */
63
+ target: View360;
64
+ /**
65
+ * Source URL / HTMLElement to load
66
+ * @ko 로드할 콘텐츠의 URL / HTMLElement
67
+ * @since 4.0.0
68
+ * @see ProjectionOptions#src
69
+ */
70
+ src: ProjectionOptions["src"];
71
+ /**
72
+ * Source's video option
73
+ * @ko 로드할 콘텐츠의 비디오 옵션
74
+ * @since 4.0.0
75
+ * @see ProjectionOptions#video
76
+ */
77
+ video: ProjectionOptions["video"];
78
+ }
79
+
80
+ /**
81
+ * An event that fires right after the content is loaded & before showing it.
82
+ * @ko 콘텐츠가 로드된 직후 발생하는 이벤트.
83
+ * @eventName load
84
+ * @eventOf View360
85
+ * @since 4.0.0
86
+ * @group Event
87
+ */
88
+ export interface LoadEvent {
89
+ /**
90
+ * @copy ReadyEvent#type
91
+ */
92
+ type: string;
93
+ /**
94
+ * @copy ReadyEvent#target
95
+ */
96
+ target: View360;
97
+ /**
98
+ * @copy LoadStartEvent#src
99
+ */
100
+ src: ProjectionOptions["src"];
101
+ /**
102
+ * @copy LoadStartEvent#video
103
+ */
104
+ video: ProjectionOptions["video"];
105
+ }
106
+
107
+ /**
108
+ * An event that fires after projection changes
109
+ * @ko 프로젝션이 변경되었을 때 발생하는 이벤트
110
+ * @eventName projectionChange
111
+ * @eventOf View360
112
+ * @group Event
113
+ * @since 4.0.0
114
+ */
115
+ export interface ProjectionChangeEvent {
116
+ /**
117
+ * @copy ReadyEvent#type
118
+ */
119
+ type: string;
120
+ /**
121
+ * @copy ReadyEvent#target
122
+ */
123
+ target: View360;
124
+ /**
125
+ * An instance of new projection applied
126
+ * @ko 새로 적용된 프로젝션의 인스턴스
127
+ * @since 4.0.0
128
+ */
129
+ projection: Projection;
130
+ }
131
+
132
+ /**
133
+ * An event that fires when {@link View360#resize} is called.
134
+ * @ko {@link View360#resize}가 호출되었을 때 발생하는 이벤트
135
+ * @eventName resize
136
+ * @eventOf View360
137
+ * @group Event
138
+ * @since 4.0.0
139
+ */
140
+ export interface ResizeEvent {
141
+ /**
142
+ * @copy ReadyEvent#type
143
+ */
144
+ type: string;
145
+ /**
146
+ * @copy ReadyEvent#target
147
+ */
148
+ target: View360;
149
+ /**
150
+ * New width of the canvas. (=`canvas.clientWidth`)
151
+ * @ko 변경된 캔버스의 너비. (=`canvas.clientWidth`)
152
+ * @since 4.0.0
153
+ */
154
+ width: number;
155
+ /**
156
+ * New height of the canvas. (=`canvas.clientHeight`)
157
+ * @ko 변경된 캔버스의 높이. (=`canvas.clientHeight`)
158
+ * @since 4.0.0
159
+ */
160
+ height: number;
161
+ }
162
+
163
+ /**
164
+ * An event that fires before rendering a frame.
165
+ * @ko 새로운 프레임 렌더 직전에 발생하는 이벤트
166
+ * @eventName beforeRender
167
+ * @eventOf View360
168
+ * @group Event
169
+ * @since 4.0.0
170
+ */
171
+ export interface BeforeRenderEvent {
172
+ /**
173
+ * @copy ReadyEvent#type
174
+ */
175
+ type: string;
176
+ /**
177
+ * @copy ReadyEvent#target
178
+ */
179
+ target: View360;
180
+ }
181
+
182
+ /**
183
+ * An event that fires after rendering a frame.
184
+ * @ko 새로운 프레임 렌더 직후에 발생하는 이벤트
185
+ * @eventName render
186
+ * @eventOf View360
187
+ * @group Event
188
+ * @since 4.0.0
189
+ */
190
+ export interface RenderEvent {
191
+ /**
192
+ * @copy ReadyEvent#type
193
+ */
194
+ type: string;
195
+ /**
196
+ * @copy ReadyEvent#target
197
+ */
198
+ target: View360;
199
+ }
200
+
201
+ /**
202
+ * An event that fires on input start.
203
+ * @ko 사용자 입력 시작 시점에 발생하는 이벤트.
204
+ * @eventName inputStart
205
+ * @eventOf View360
206
+ * @group Event
207
+ * @since 4.0.0
208
+ */
209
+ export interface InputStartEvent {
210
+ /**
211
+ * @copy ReadyEvent#type
212
+ */
213
+ type: string;
214
+ /**
215
+ * @copy ReadyEvent#target
216
+ */
217
+ target: View360;
218
+ /**
219
+ * Source {@link https://developer.mozilla.org/en-US/docs/Web/API/Event Event} of the input.
220
+ * @ko 사용자 입력의 {@link https://developer.mozilla.org/en-US/docs/Web/API/Event Event} 인스턴스.
221
+ * @since 4.0.0
222
+ */
223
+ srcEvent: MouseEvent | TouchEvent | KeyboardEvent;
224
+ /**
225
+ * Type of the input.
226
+ * @ko 사용자 입력의 종류.
227
+ * @since 4.0.0
228
+ */
229
+ inputType: "rotate" | "zoom";
230
+ /**
231
+ * Whether the input was touch.
232
+ * @ko 사용자 입력이 터치를 통한 것이었는지 여부를 나타내는 값.
233
+ * @since 4.0.0
234
+ */
235
+ isTouch: boolean;
236
+ /**
237
+ * Whether the input was keyboard.
238
+ * @ko 사용자 입력이 키보드를 통한 것이었는지 여부를 나타내는 값.
239
+ * @since 4.0.0
240
+ */
241
+ isKeyboard: boolean;
242
+ }
243
+
244
+ /**
245
+ * An event that fires on input end.
246
+ * @ko 사용자 입력이 끝날 때 발생하는 이벤트.
247
+ * @eventName inputEnd
248
+ * @eventOf View360
249
+ * @group Event
250
+ * @since 4.0.0
251
+ */
252
+ export interface InputEndEvent {
253
+ /**
254
+ * @copy ReadyEvent#type
255
+ */
256
+ type: string;
257
+ /**
258
+ * @copy ReadyEvent#target
259
+ */
260
+ target: View360;
261
+ /**
262
+ * @copy InputStartEvent#inputType
263
+ */
264
+ inputType: "rotate" | "zoom";
265
+ /**
266
+ * @copy InputStartEvent#isTouch
267
+ */
268
+ isTouch: boolean;
269
+ /**
270
+ * @copy InputStartEvent#isKeyboard
271
+ */
272
+ isKeyboard: boolean;
273
+ /**
274
+ * Whether the page scroll triggered during the input on the touch devices.
275
+ * When the page has scrolled, input itself is blocked so you can ignore the input sequence when this value is `true`.
276
+ * @ko 터치 디바이스에서 입력 도중 스크롤이 발생하였는지 여부.
277
+ * 이 경우 실제로 카메라 회전은 블락되어 일어나지 않기 때문에, 해당 입력 시퀀스는 무시해도 좋습니다.
278
+ * @since 4.0.0
279
+ */
280
+ scrolling: boolean;
281
+ }
282
+
283
+ /**
284
+ * An event that fires on camera view direction change.
285
+ * This is triggered only on frame render.
286
+ * In other words, even if the actual camera orientation changes several times between frame renderings, the actual event is triggered only with the camera's direction at the time the screen is updated.
287
+ * @ko 카메라가 보는 방향이 변경되었을 때 발생하는 이벤트.
288
+ * 이 이벤트는 프레임이 렌더링되었을때만 발생합니다.
289
+ * 즉, 프레임 렌더 사이에 실제 카메라 방향이 여러번 변경되더라도 실제 이벤트는 화면 갱신이 이루어지는 시점에 바라보는 값으로만 트리거됩니다.
290
+ * @eventName viewChange
291
+ * @eventOf View360
292
+ * @group Event
293
+ * @since 4.0.0
294
+ */
295
+ export interface ViewChangeEvent {
296
+ /**
297
+ * @copy ReadyEvent#type
298
+ */
299
+ type: string;
300
+ /**
301
+ * @copy ReadyEvent#target
302
+ */
303
+ target: View360;
304
+ /**
305
+ * Camera's new yaw value.
306
+ * @ko 갱신된 카메라의 yaw 값.
307
+ * @since 4.0.0
308
+ */
309
+ yaw: number;
310
+ /**
311
+ * Camera's new pitch value.
312
+ * @ko 갱신된 카메라의 pitch 값.
313
+ * @since 4.0.0
314
+ */
315
+ pitch: number;
316
+ /**
317
+ * Camera's new zoom value.
318
+ * @ko 갱신된 카메라의 zoom 값.
319
+ * @since 4.0.0
320
+ */
321
+ zoom: number;
322
+ /**
323
+ * Camera's new quaternion value. (x, y, z, w)
324
+ * @ko 갱신된 카메라의 회전 quaternion 값. (x, y, z, w)
325
+ * @since 4.0.0
326
+ */
327
+ quaternion: number[];
328
+ }
329
+
330
+ /**
331
+ * An event that fires after clicking on canvas element without dragging.
332
+ * @ko 캔버스 엘리먼트를 드래그하지 않고 클릭했을 때 발생하는 이벤트.
333
+ * @eventName staticClick
334
+ * @eventOf View360
335
+ * @group Event
336
+ * @since 4.0.0
337
+ */
338
+ export interface StaticClickEvent {
339
+ /**
340
+ * @copy ReadyEvent#type
341
+ */
342
+ type: string;
343
+ /**
344
+ * @copy ReadyEvent#target
345
+ */
346
+ target: View360;
347
+ /**
348
+ * @copy InputStartEvent#isTouch
349
+ */
350
+ isTouch: boolean;
351
+ }
352
+
353
+ /**
354
+ * An event that fires after entering VR mode
355
+ * @ko VR 세션에 진입한 직후에 발생하는 이벤트
356
+ * @eventName vrStart
357
+ * @eventOf View360
358
+ * @group Event
359
+ * @since 4.0.0
360
+ */
361
+ export interface VRStartEvent {
362
+ /**
363
+ * @copy ReadyEvent#type
364
+ */
365
+ type: string;
366
+ /**
367
+ * @copy ReadyEvent#target
368
+ */
369
+ target: View360;
370
+ }
371
+
372
+ /**
373
+ * An event that fires after exiting VR mode
374
+ * @ko VR 세션이 끝난 이후에 발생하는 이벤트
375
+ * @eventName vrEnd
376
+ * @eventOf View360
377
+ * @group Event
378
+ * @since 4.0.0
379
+ */
380
+ export interface VREndEvent {
381
+ /**
382
+ * @copy ReadyEvent#type
383
+ */
384
+ type: string;
385
+ /**
386
+ * @copy ReadyEvent#target
387
+ */
388
+ target: View360;
389
+ }
@@ -0,0 +1,78 @@
1
+ /*
2
+ * Copyright (c) 2023-present NAVER Corp.
3
+ * egjs projects are licensed under the MIT license
4
+ */
5
+ import type Hls from "hls.js";
6
+ export * from "./events";
7
+
8
+ /**
9
+ * Config for the video source, mainly standard attributes for the video element.
10
+ * @ko 비디오 타입의 파노라마 소스에 적용할 옵션, 대부분 비디오 엘리먼트의 어트리뷰트에 적용할 값들입니다.
11
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#attributes
12
+ * @since 4.0.0
13
+ */
14
+ export interface VideoConfig {
15
+ /**
16
+ * Whether to initially set video silenced.
17
+ * :::caution
18
+ * This should be `true` to enable {@link VideoConfig#autoplay}.
19
+ * :::
20
+ * @ko 비디오를 음소거한 상태로 재생을 시작할지 여부.
21
+ * :::caution
22
+ * {@link VideoConfig#autoplay}를 사용하기 위해서는 반드시 `true`로 설정되어야 합니다.
23
+ * :::
24
+ * @since 4.0.0
25
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#attr-muted
26
+ */
27
+ muted: boolean;
28
+ /**
29
+ * If `true`, the browser will automatically seek back to the start upon reaching the end of the video.
30
+ * @ko `true`일 경우 비디오가 끝날 때 자동으로 처음부터 다시 재생합니다.
31
+ * @since 4.0.0
32
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#attr-loop
33
+ */
34
+ loop: boolean;
35
+ /**
36
+ * If `true`, the video automatically begins to play back as soon as it can do so without stopping to finish loading the data.
37
+ * :::caution
38
+ * {@link VideoConfig#muted} should be `true` to enable this option.
39
+ * :::
40
+ * @ko `true`일 경우, 뷰어가 로딩된 다음에 바로 비디오를 재생합니다.
41
+ * :::caution
42
+ * {@link VideoConfig#muted}가 `true`여야만 사용 가능합니다.
43
+ * :::
44
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#attr-autoplay
45
+ */
46
+ autoplay: boolean;
47
+ /**
48
+ * Initial volume. (0~1)
49
+ * @ko 비디오 초기화시 적용할 볼륨값. (0~1)
50
+ * @since 4.0.0
51
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/volume
52
+ */
53
+ volume: number;
54
+ /**
55
+ * HLS configuration for m3u8 playback.
56
+ * @ko m3u8 재생을 위한 HLS 설정.
57
+ * @since 4.0.0
58
+ */
59
+ hlsConfig?: {
60
+ /**
61
+ * Whether to enable HLS support for this video.
62
+ * @ko HLS 사용 여부.
63
+ * @default false
64
+ */
65
+ enabled?: boolean;
66
+ /**
67
+ * Force HLS initialization even when the source does not end with .m3u8.
68
+ * @ko 소스가 .m3u8이 아니어도 HLS를 강제로 활성화할지 여부.
69
+ * @default false
70
+ */
71
+ force?: boolean;
72
+ /**
73
+ * Options passed to hls.js constructor.
74
+ * @ko hls.js 생성자 옵션.
75
+ */
76
+ config?: Hls.Config;
77
+ };
78
+ }
@@ -0,0 +1,54 @@
1
+ /*
2
+ * Copyright (c) 2023-present NAVER Corp.
3
+ * egjs projects are licensed under the MIT license
4
+ */
5
+ import CameraControl from "../control/CameraControl";
6
+ import Uniform from "../uniform/Uniform";
7
+ import UniformMatrix from "../uniform/UniformMatrix";
8
+ import { CONTROL_EVENTS } from "../const/internal";
9
+
10
+ export interface CommonUniforms {
11
+ uMVMatrix: UniformMatrix
12
+ uPMatrix: UniformMatrix
13
+ }
14
+
15
+ export type UniformLocations<T extends Record<string, Uniform | null>> = {
16
+ [key in keyof (T & CommonUniforms)]: WebGLUniformLocation
17
+ };
18
+
19
+ export interface InputEvents<DeltaType, BrowserEvent = MouseEvent | TouchEvent | KeyboardEvent> {
20
+ [CONTROL_EVENTS.INPUT_START]: {
21
+ srcEvent: BrowserEvent;
22
+ isTouch: boolean;
23
+ isKeyboard: boolean;
24
+ };
25
+ [CONTROL_EVENTS.CHANGE]: {
26
+ delta: DeltaType;
27
+ isTouch: boolean;
28
+ isKeyboard: boolean;
29
+ };
30
+ [CONTROL_EVENTS.INPUT_END]: {
31
+ isTouch: boolean;
32
+ isKeyboard: boolean;
33
+ scrolling: boolean;
34
+ };
35
+ [CONTROL_EVENTS.STATIC_CLICK]: {
36
+ isTouch: boolean;
37
+ };
38
+ [CONTROL_EVENTS.ENABLE]: {
39
+ control: CameraControl;
40
+ updateCursor: boolean;
41
+ };
42
+ [CONTROL_EVENTS.DISABLE]: {
43
+ updateCursor: boolean
44
+ };
45
+ }
46
+
47
+ export interface ControlEvents<DeltaType> extends InputEvents<DeltaType> {
48
+ [CONTROL_EVENTS.INPUT_START]: { inputType: "rotate" | "zoom" }
49
+ & InputEvents<DeltaType>[typeof CONTROL_EVENTS.INPUT_START];
50
+ [CONTROL_EVENTS.INPUT_END]: { inputType: "rotate" | "zoom" }
51
+ & InputEvents<DeltaType>[typeof CONTROL_EVENTS.INPUT_END];
52
+ }
53
+
54
+ export type VAO = WebGLVertexArrayObject | WebGLVertexArrayObjectOES;
@@ -0,0 +1,27 @@
1
+ /*
2
+ * Copyright (c) 2023-present NAVER Corp.
3
+ * egjs projects are licensed under the MIT license
4
+ */
5
+ export type ValueOf<T> = T[keyof T];
6
+ export type LiteralUnion<T extends U, U = string> = T | (Pick<U, never> & {_?: never});
7
+ export type NoBoolean<T> = T extends boolean ? never : T;
8
+
9
+ export interface Range {
10
+ min: number;
11
+ max: number;
12
+ }
13
+
14
+ export type TypedArray =
15
+ | Int8Array
16
+ | Uint8Array
17
+ | Uint8ClampedArray
18
+ | Int16Array
19
+ | Uint16Array
20
+ | Int32Array
21
+ | Uint32Array
22
+ | Float32Array
23
+ | Float64Array;
24
+
25
+ export type EventParams<T extends Record<string, any>, K extends keyof T> = Omit<T[K], "type" | "target"> extends Record<string, never>
26
+ ? never
27
+ : [Omit<T[K], "type" | "target">];
@@ -0,0 +1,78 @@
1
+ declare module "hls.js" {
2
+ export interface HlsConfig {
3
+ [key: string]: any;
4
+ algoDataEnabled?: boolean;
5
+ algoSegmentPattern?: RegExp | string;
6
+ algoPreloadCount?: number;
7
+ algoCacheSize?: number;
8
+ algoFrameRate?: number;
9
+ }
10
+
11
+ type AutoCameraItem = {
12
+ x: number;
13
+ y: number;
14
+ focus: number;
15
+ reserved?: number[];
16
+ };
17
+
18
+ type TrackItem = {
19
+ trackId: number;
20
+ score: number;
21
+ box: [number, number, number, number];
22
+ reserved?: number[];
23
+ };
24
+
25
+ type DetItem = {
26
+ classId: number;
27
+ score: number;
28
+ box: [number, number, number, number];
29
+ reserved?: number[];
30
+ };
31
+
32
+ type FrameItem = {
33
+ frameIdx: number;
34
+ autoCameras: AutoCameraItem;
35
+ tracks: TrackItem[];
36
+ detections: DetItem[];
37
+ };
38
+
39
+ type AlgoChunk = {
40
+ fragSn: number;
41
+ algoUrl: string;
42
+ chunkIndex: number;
43
+ frameSize: number;
44
+ frameRate: number;
45
+ startFrameIndex: number;
46
+ frames: FrameItem[];
47
+ };
48
+
49
+ type AlgoDataLoadedEvent = {
50
+ chunk: AlgoChunk;
51
+ };
52
+
53
+ class Hls {
54
+ public static isSupported(): boolean;
55
+ public constructor(config?: HlsConfig);
56
+ public loadSource(url: string): void;
57
+ public attachMedia(media: HTMLMediaElement): void;
58
+ public destroy(): void;
59
+ public on(eventName: string, handler: (...args: any[]) => void): void;
60
+ public off(eventName: string, handler: (...args: any[]) => void): void;
61
+ public getAlgoFrameByTime(time: number): FrameItem | null;
62
+ public getAlgoFrameByIndex(frameIdx: number): FrameItem | null;
63
+ public isAlgoDataReady(time: number): boolean;
64
+ public isAlgoDataReadyByIndex(frameIdx: number): boolean;
65
+ public getAllCachedAlgoChunks(): AlgoChunk[];
66
+ }
67
+
68
+ namespace Hls {
69
+ type Config = HlsConfig;
70
+ const Events: {
71
+ ALGO_DATA_LOADING: string;
72
+ ALGO_DATA_LOADED: string;
73
+ ALGO_DATA_ERROR: string;
74
+ };
75
+ }
76
+
77
+ export default Hls;
78
+ }
@@ -0,0 +1,20 @@
1
+ /*
2
+ * Copyright (c) 2023-present NAVER Corp.
3
+ * egjs projects are licensed under the MIT license
4
+ */
5
+ abstract class Uniform {
6
+ public needsUpdate: boolean;
7
+
8
+ public constructor() {
9
+ this.needsUpdate = true;
10
+ }
11
+
12
+ public abstract update(gl: WebGLRenderingContext | WebGL2RenderingContext, location: WebGLUniformLocation, isWebGL2: boolean): void;
13
+
14
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
15
+ public destroy(gl: WebGLRenderingContext | WebGL2RenderingContext) {
16
+ // DO_NOTHING
17
+ }
18
+ }
19
+
20
+ export default Uniform;
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2023-present NAVER Corp.
3
+ * egjs projects are licensed under the MIT license
4
+ */
5
+ import Uniform from "./Uniform";
6
+
7
+ class UniformBoolean extends Uniform {
8
+ public val: boolean;
9
+
10
+ public constructor(val: boolean) {
11
+ super();
12
+
13
+ this.val = val;
14
+ }
15
+
16
+ public update(gl: WebGLRenderingContext | WebGL2RenderingContext, location: WebGLUniformLocation) {
17
+ gl.uniform1f(location, this.val ? 1 : 0);
18
+
19
+ this.needsUpdate = false;
20
+ }
21
+ }
22
+
23
+ export default UniformBoolean;
@@ -0,0 +1,44 @@
1
+ /*
2
+ * Copyright (c) 2023-present NAVER Corp.
3
+ * egjs projects are licensed under the MIT license
4
+ */
5
+ import CubeTexturePainter from "../core/CubeTexturePainter";
6
+ import Texture2D from "../texture/Texture2D";
7
+ import WebGLContext from "../core/WebGLContext";
8
+ import Uniform from "./Uniform";
9
+
10
+ class UniformCanvasCube extends Uniform {
11
+ private _webglTexture: WebGLTexture;
12
+ private _painter: CubeTexturePainter;
13
+
14
+ public get texture() { return this._painter.texture; }
15
+
16
+ public constructor(ctx: WebGLContext, texture: Texture2D, cubemapOrder: string) {
17
+ super();
18
+
19
+ this._painter = new CubeTexturePainter(texture as Texture2D, cubemapOrder);
20
+ this._webglTexture = ctx.createWebGLCubeTexture(texture, this._painter.size);
21
+ }
22
+
23
+ public destroy(gl: WebGLRenderingContext | WebGL2RenderingContext) {
24
+ gl.deleteTexture(this._webglTexture);
25
+ this._painter.destroy();
26
+ }
27
+
28
+ public update(gl: WebGLRenderingContext | WebGL2RenderingContext, location: WebGLUniformLocation, isWebGL2: boolean) {
29
+ const texture = this.texture;
30
+
31
+ gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
32
+ gl.uniform1i(location, 0);
33
+ gl.activeTexture(gl.TEXTURE0);
34
+ gl.bindTexture(gl.TEXTURE_CUBE_MAP, this._webglTexture);
35
+
36
+ this._painter.draw(gl, isWebGL2);
37
+
38
+ if (!texture.isVideo()) {
39
+ this.needsUpdate = false;
40
+ }
41
+ }
42
+ }
43
+
44
+ export default UniformCanvasCube;