ohzi-core 12.2.0 → 12.2.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 (276) hide show
  1. package/build/index.mjs +1 -1
  2. package/build/index.mjs.map +1 -1
  3. package/build/index.module.js +2 -0
  4. package/build/index.module.js.map +1 -0
  5. package/package.json +2 -1
  6. package/src/BaseApplication.js +11 -2
  7. package/src/Browser.js +10 -3
  8. package/src/CameraManager.js +5 -0
  9. package/src/Capabilities.js +1 -0
  10. package/src/CustomBezierCurve.js +12 -0
  11. package/src/Debug.js +99 -5
  12. package/src/Graphics.js +86 -6
  13. package/src/Initializer.js +5 -0
  14. package/src/KeyboardInput.js +40 -1
  15. package/src/OS.js +1 -1
  16. package/src/OScreen.js +19 -4
  17. package/src/OrthographicCamera.js +13 -0
  18. package/src/PerspectiveCamera.js +11 -0
  19. package/src/ReflectionPlaneContext.js +5 -1
  20. package/src/RenderLayers.js +1 -1
  21. package/src/RenderLoop.js +9 -0
  22. package/src/RenderOrder.js +1 -1
  23. package/src/ResourceContainer.js +21 -0
  24. package/src/SceneManager.js +14 -4
  25. package/src/Screen.js +71 -0
  26. package/src/Time.js +4 -0
  27. package/src/UI.js +16 -1
  28. package/src/action_sequencer/ActionEvent.js +6 -1
  29. package/src/action_sequencer/ActionInterpolator.js +16 -2
  30. package/src/action_sequencer/ActionSequencer.js +65 -2
  31. package/src/action_sequencer/NumberInterpolator.js +15 -0
  32. package/src/action_sequencer/VectorInterpolator.js +13 -1
  33. package/src/blitter_index.js +1 -0
  34. package/src/canvas_drawer/CanvasDrawer.js +37 -4
  35. package/src/canvas_drawer/MultiLineTextDrawer.js +8 -1
  36. package/src/canvas_drawer/SimpleTextDrawer.js +7 -1
  37. package/src/components/AudioClip.js +11 -1
  38. package/src/components/AxisHelper.js +1 -1
  39. package/src/components/BaseObject.js +8 -5
  40. package/src/components/EdgeMesh.js +30 -2
  41. package/src/components/GeometryEdgeVisualizer.js +10 -1
  42. package/src/components/Grid.js +4 -0
  43. package/src/components/Line.js +31 -7
  44. package/src/components/MultiLinePath.js +9 -5
  45. package/src/components/MultiLineText2D.js +13 -2
  46. package/src/components/ObjectAxis.js +5 -0
  47. package/src/components/ObjectOrientedBoundingBox.js +26 -1
  48. package/src/components/PlaneHelper.js +1 -1
  49. package/src/components/Shape2D.js +11 -3
  50. package/src/components/Shape3D.js +10 -4
  51. package/src/components/Text2D.js +11 -3
  52. package/src/components/UIElement.js +40 -4
  53. package/src/components/UpdatableMaterialMesh.js +11 -3
  54. package/src/components/WorldImage.js +10 -2
  55. package/src/index.js +3 -1
  56. package/src/loaders/AsyncAbstractLoader.js +16 -0
  57. package/src/loaders/AsyncObjectsLoader.js +6 -0
  58. package/src/primitives/Arrow.js +6 -0
  59. package/src/primitives/Cube.js +6 -1
  60. package/src/primitives/HorizontalPlane.js +8 -1
  61. package/src/primitives/Sphere.js +7 -0
  62. package/src/primitives/VerticalPlane.js +8 -1
  63. package/src/ui/ui_element_state/OnIdle.js +5 -0
  64. package/src/ui/ui_element_state/OnMouseEnter.js +11 -0
  65. package/src/ui/ui_element_state/OnMouseExit.js +5 -0
  66. package/src/ui/ui_element_state/OnMouseHover.js +13 -0
  67. package/src/ui/ui_element_state/UIElementState.js +17 -3
  68. package/src/utilities/EasingFunctions.js +5 -0
  69. package/types/BaseApplication.d.ts +18 -11
  70. package/types/Browser.d.ts +20 -19
  71. package/types/CameraManager.d.ts +14 -13
  72. package/types/Capabilities.d.ts +8 -8
  73. package/types/CustomBezierCurve.d.ts +19 -7
  74. package/types/Debug.d.ts +198 -37
  75. package/types/Graphics.d.ts +143 -61
  76. package/types/Initializer.d.ts +10 -6
  77. package/types/KeyboardInput.d.ts +65 -20
  78. package/types/OS.d.ts +20 -20
  79. package/types/OScreen.d.ts +37 -22
  80. package/types/OrthographicCamera.d.ts +20 -6
  81. package/types/PerspectiveCamera.d.ts +18 -6
  82. package/types/ReflectionPlaneContext.d.ts +13 -8
  83. package/types/RenderLayers.d.ts +6 -6
  84. package/types/RenderLoop.d.ts +132 -14
  85. package/types/RenderOrder.d.ts +8 -8
  86. package/types/ResourceContainer.d.ts +29 -10
  87. package/types/SceneManager.d.ts +15 -12
  88. package/types/Screen.d.ts +27 -0
  89. package/types/Time.d.ts +29 -24
  90. package/types/UI.d.ts +92 -18
  91. package/types/action_sequencer/ActionEvent.d.ts +12 -7
  92. package/types/action_sequencer/ActionInterpolator.d.ts +18 -5
  93. package/types/action_sequencer/ActionSequencer.d.ts +104 -36
  94. package/types/action_sequencer/NumberInterpolator.d.ts +18 -9
  95. package/types/action_sequencer/VectorInterpolator.d.ts +13 -7
  96. package/types/blitter_index.d.ts +6 -6
  97. package/types/canvas_drawer/CanvasDrawer.d.ts +51 -13
  98. package/types/canvas_drawer/MultiLineTextDrawer.d.ts +13 -5
  99. package/types/canvas_drawer/SimpleTextDrawer.d.ts +13 -6
  100. package/types/components/AudioClip.d.ts +25 -13
  101. package/types/components/AxisHelper.d.ts +6 -6
  102. package/types/components/BaseObject.d.ts +12 -5
  103. package/types/components/EdgeMesh.d.ts +42 -13
  104. package/types/components/GeometryEdgeVisualizer.d.ts +12 -4
  105. package/types/components/Grid.d.ts +4 -2
  106. package/types/components/Line.d.ts +42 -16
  107. package/types/components/MultiLinePath.d.ts +10 -4
  108. package/types/components/MultiLineText2D.d.ts +22 -10
  109. package/types/components/ObjectAxis.d.ts +8 -3
  110. package/types/components/ObjectOrientedBoundingBox.d.ts +45 -18
  111. package/types/components/PlaneHelper.d.ts +6 -6
  112. package/types/components/Shape2D.d.ts +14 -4
  113. package/types/components/Shape3D.d.ts +10 -3
  114. package/types/components/Text2D.d.ts +21 -13
  115. package/types/components/UIElement.d.ts +87 -52
  116. package/types/components/UpdatableMaterialMesh.d.ts +12 -4
  117. package/types/components/WorldImage.d.ts +23 -13
  118. package/types/components/mouse_interactors/ObjectRotator.d.ts +12 -0
  119. package/types/components/sdf_text/SDFText.d.ts +35 -30
  120. package/types/components/sdf_text/SDFTextBatch.d.ts +12 -12
  121. package/types/components/sdf_text/TextGlyph.d.ts +8 -6
  122. package/types/data_textures/CustomDataTexture.d.ts +11 -11
  123. package/types/data_textures/RGBADataTexture.d.ts +4 -4
  124. package/types/data_textures/RGBAFloatDataTexture.d.ts +4 -4
  125. package/types/data_textures/RGBDataTexture.d.ts +4 -4
  126. package/types/data_textures/RGBFloatDataTexture.d.ts +4 -4
  127. package/types/editor/ManipulatorHandle.d.ts +23 -14
  128. package/types/editor/ObjectEditor.d.ts +18 -16
  129. package/types/editor/ObjectManipulator.d.ts +23 -19
  130. package/types/editor/ObjectPicker.d.ts +19 -16
  131. package/types/gpu_particles/GPUParticleSystem.d.ts +22 -15
  132. package/types/gpu_particles/ParticleAttribute.d.ts +19 -18
  133. package/types/gpu_particles/ParticlePositionAttribute.d.ts +6 -6
  134. package/types/html_utilities/CSSAnimator.d.ts +31 -31
  135. package/types/html_utilities/css_animator_states/Animating.d.ts +8 -8
  136. package/types/html_utilities/css_animator_states/Idle.d.ts +6 -6
  137. package/types/index.d.ts +110 -108
  138. package/types/loaders/AsyncAbstractLoader.d.ts +41 -27
  139. package/types/loaders/AsyncAudiosLoader.d.ts +6 -5
  140. package/types/loaders/AsyncObjectsLoader.d.ts +6 -6
  141. package/types/loaders/AsyncTexturesLoader.d.ts +9 -8
  142. package/types/loaders/assets_loader/AssetLoader.d.ts +4 -0
  143. package/types/loaders/assets_loader/AsyncAssetsLoaderWorker.d.ts +1 -0
  144. package/types/loaders/assets_loader/ResourceBatch.d.ts +14 -0
  145. package/types/loaders/assets_loader/ResourceContainer.d.ts +9 -0
  146. package/types/loaders/assets_loader/ResourceLoaderChecker.d.ts +8 -0
  147. package/types/materials/AddMaterial.d.ts +5 -5
  148. package/types/materials/AlphaFilterMaterial.d.ts +6 -6
  149. package/types/materials/BaseShaderMaterial.d.ts +4 -3
  150. package/types/materials/BlitMaterial.d.ts +4 -3
  151. package/types/materials/BloomComposeMaterial.d.ts +4 -7
  152. package/types/materials/BoxBlurMaterial.d.ts +4 -4
  153. package/types/materials/ClearAlphaMaterial.d.ts +3 -3
  154. package/types/materials/ClearColorMaterial.d.ts +7 -7
  155. package/types/materials/ClearDepthNormalMaterial.d.ts +4 -4
  156. package/types/materials/DeferredRendererComposeMaterial.d.ts +7 -7
  157. package/types/materials/DepthNormalMaterial.d.ts +6 -4
  158. package/types/materials/DisplayNormalTextureMaterial.d.ts +4 -4
  159. package/types/materials/DualFilteringBlurMaterial.d.ts +4 -4
  160. package/types/materials/FXAAMaterial.d.ts +3 -3
  161. package/types/materials/GaussianBlurMaterial.d.ts +6 -6
  162. package/types/materials/LuminosityHighPassMaterial.d.ts +4 -4
  163. package/types/materials/MedianFilterMaterial.d.ts +7 -6
  164. package/types/materials/NormalMaterial.d.ts +4 -2
  165. package/types/materials/SDFScreenTextMaterial.d.ts +9 -11
  166. package/types/materials/SDFTextMaterial.d.ts +10 -12
  167. package/types/materials/SSAOComposeMaterial.d.ts +4 -4
  168. package/types/materials/SSAOMaterial.d.ts +8 -6
  169. package/types/materials/ScreenSpaceTextureMaterial.d.ts +7 -7
  170. package/types/materials/UIElementMaterial.d.ts +4 -7
  171. package/types/materials/UnrealBloomComposeMaterial.d.ts +16 -16
  172. package/types/materials/UnrealBlurMaterial.d.ts +4 -4
  173. package/types/materials/UnrealComposeMaterial.d.ts +4 -4
  174. package/types/materials/ViewPositionMaterial.d.ts +4 -3
  175. package/types/materials/deferred/DeferredPointLightMaterial.d.ts +9 -10
  176. package/types/materials/gpu_particles/AttributeUpdateMaterial.d.ts +7 -0
  177. package/types/materials/gpu_particles/BasicParticleMaterial.d.ts +4 -0
  178. package/types/materials/gpu_particles/ParticleStorageMaterial.d.ts +4 -2
  179. package/types/materials/gpu_particles/PositionStorageMaterial.d.ts +3 -4
  180. package/types/object_pool/Pool.d.ts +10 -10
  181. package/types/primitives/Arrow.d.ts +15 -8
  182. package/types/primitives/Cube.d.ts +10 -3
  183. package/types/primitives/HorizontalPlane.d.ts +11 -3
  184. package/types/primitives/Sphere.d.ts +11 -3
  185. package/types/primitives/VerticalPlane.d.ts +11 -3
  186. package/types/raycast/GroupRaycaster.d.ts +15 -13
  187. package/types/raycast/PlaneDragResolver.d.ts +16 -15
  188. package/types/raycast/PlaneRaycastResolver.d.ts +5 -5
  189. package/types/raycast/PlaneRaycaster.d.ts +9 -7
  190. package/types/raycast/RaycastResolver.d.ts +5 -5
  191. package/types/raycast/SurfaceDragResolver.d.ts +15 -13
  192. package/types/raycast/states/BaseState.d.ts +5 -5
  193. package/types/raycast/states/IdleState.d.ts +3 -5
  194. package/types/raycast/states/OnRaycastEnter.d.ts +3 -5
  195. package/types/raycast/states/OnRaycastExit.d.ts +3 -4
  196. package/types/raycast/states/OnRaycastHover.d.ts +3 -5
  197. package/types/render_mode/BaseRender.d.ts +7 -7
  198. package/types/render_mode/BloomRender.d.ts +12 -10
  199. package/types/render_mode/DebugNormalsRender.d.ts +3 -3
  200. package/types/render_mode/DeferredRender.d.ts +13 -9
  201. package/types/render_mode/NormalAORender.d.ts +18 -17
  202. package/types/render_mode/NormalRender.d.ts +3 -3
  203. package/types/render_mode/OutlineRender.d.ts +25 -20
  204. package/types/render_mode/PlanarReflectionsRender.d.ts +19 -13
  205. package/types/render_mode/UnrealBloomRender.d.ts +21 -20
  206. package/types/render_mode/VRRender.d.ts +4 -4
  207. package/types/render_utilities/Blitter.d.ts +19 -15
  208. package/types/render_utilities/Blurrer.d.ts +9 -8
  209. package/types/render_utilities/DepthAndNormalsRenderer.d.ts +11 -10
  210. package/types/render_utilities/DualFilteringBlurrer.d.ts +18 -17
  211. package/types/render_utilities/GaussianBlurrer.d.ts +27 -26
  212. package/types/render_utilities/MedianFilter.d.ts +11 -9
  213. package/types/render_utilities/ViewPositionRenderer.d.ts +10 -9
  214. package/types/resource_loader/AbstractLoader.d.ts +21 -21
  215. package/types/resource_loader/AsyncTextureLoader.d.ts +11 -11
  216. package/types/resource_loader/AudioLoader.d.ts +9 -9
  217. package/types/resource_loader/BasisLoader.d.ts +6 -6
  218. package/types/resource_loader/CubemapLoader.d.ts +8 -7
  219. package/types/resource_loader/DAELoader.d.ts +7 -6
  220. package/types/resource_loader/DDSLoader.d.ts +7 -6
  221. package/types/resource_loader/FileLoader.d.ts +7 -6
  222. package/types/resource_loader/FontLoader.d.ts +7 -6
  223. package/types/resource_loader/GLTFDRACOLoader.d.ts +7 -6
  224. package/types/resource_loader/GLTFLoader.d.ts +7 -6
  225. package/types/resource_loader/HDRCubeTextureLoader.d.ts +8 -7
  226. package/types/resource_loader/JSONLoader.d.ts +5 -4
  227. package/types/resource_loader/OBJLoader.d.ts +7 -6
  228. package/types/resource_loader/PointArrayLoader.d.ts +9 -7
  229. package/types/resource_loader/RGBETextureLoader.d.ts +7 -6
  230. package/types/resource_loader/ResourceBatch.d.ts +13 -13
  231. package/types/resource_loader/SVGLoader.d.ts +7 -6
  232. package/types/resource_loader/TextLoader.d.ts +7 -6
  233. package/types/resource_loader/TextureLoader.d.ts +4 -4
  234. package/types/resource_loader/VideoLoader.d.ts +4 -4
  235. package/types/scenes/AbstractScene.d.ts +32 -32
  236. package/types/scenes/loading_states/CompilatorManager.d.ts +8 -8
  237. package/types/scenes/loading_states/HighQualityLoadingState.d.ts +3 -3
  238. package/types/scenes/loading_states/LoadingState.d.ts +31 -31
  239. package/types/scenes/loading_states/RegularLoadingState.d.ts +5 -5
  240. package/types/static_batcher/BatchedMesh.d.ts +16 -15
  241. package/types/static_batcher/GeometryBatch.d.ts +41 -37
  242. package/types/static_batcher/GeometryBatcher.d.ts +9 -9
  243. package/types/static_batcher/MeshBatcher.d.ts +5 -5
  244. package/types/ui/ui_element_position/ScreenSpacePosition.d.ts +5 -4
  245. package/types/ui/ui_element_position/WorldSpacePosition.d.ts +7 -5
  246. package/types/ui/ui_element_state/OnIdle.d.ts +9 -3
  247. package/types/ui/ui_element_state/OnMouseEnter.d.ts +3 -3
  248. package/types/ui/ui_element_state/OnMouseExit.d.ts +3 -3
  249. package/types/ui/ui_element_state/OnMouseHover.d.ts +8 -4
  250. package/types/ui/ui_element_state/UIElementState.d.ts +17 -5
  251. package/types/utilities/ArrayUtilities.d.ts +7 -7
  252. package/types/utilities/CameraUtilities.d.ts +40 -36
  253. package/types/utilities/EasingFunctions.d.ts +36 -35
  254. package/types/utilities/FrustumPointFitter.d.ts +14 -14
  255. package/types/utilities/GeometryUtilities.d.ts +5 -4
  256. package/types/utilities/HTMLUtilities.d.ts +6 -6
  257. package/types/utilities/ImageUtilities.d.ts +5 -4
  258. package/types/utilities/MeshSampler.d.ts +20 -20
  259. package/types/utilities/ModelUtilities.d.ts +15 -15
  260. package/types/utilities/OMath.d.ts +21 -21
  261. package/types/utilities/ObjectUtilities.d.ts +7 -7
  262. package/types/utilities/OrthographicFrustumPointFitter.d.ts +8 -7
  263. package/types/utilities/PerspectiveFrustumPointFitter.d.ts +14 -12
  264. package/types/utilities/StringUtilities.d.ts +6 -6
  265. package/types/utilities/TimeUtilities.d.ts +3 -3
  266. package/types/utilities/Validation.d.ts +6 -6
  267. package/types/view_components/ApplicationView.d.ts +13 -13
  268. package/types/view_components/TransitionManager.d.ts +20 -20
  269. package/types/view_components/ViewComponent.d.ts +15 -15
  270. package/types/view_components/ViewComponentManager.d.ts +13 -13
  271. package/types/view_components/ViewManager.d.ts +22 -23
  272. package/types/view_components/ViewState.d.ts +14 -14
  273. package/types/view_components/transition/ActionSequencerBuilder.d.ts +16 -16
  274. package/types/view_components/transition/DrawIOAnimationSheet.d.ts +17 -17
  275. package/types/view_components/transition/TransitionTable.d.ts +8 -8
  276. package/types/view_components/transition/ViewStateTransitionHandler.d.ts +19 -19
@@ -1,8 +1,13 @@
1
-
1
+ // @ts-check
2
2
  import { OMath } from '../utilities/OMath';
3
+ import { ActionEvent } from './ActionEvent'; // eslint-disable-line no-unused-vars
4
+ import { ActionInterpolator } from './ActionInterpolator'; // eslint-disable-line no-unused-vars
3
5
 
4
6
  class ActionSequencer
5
7
  {
8
+ /**
9
+ * @param {any} [context]
10
+ */
6
11
  constructor(context = {})
7
12
  {
8
13
  this.previous_elapsed_time = -0.00001;
@@ -10,6 +15,7 @@ class ActionSequencer
10
15
  this.playback_speed = this.__get_playback_speed();
11
16
  this.playing = true;
12
17
 
18
+ /** @type {{action:ActionEvent, trigger_time:number }[]} */
13
19
  this.action_events = [];
14
20
  this.context = context;
15
21
 
@@ -17,6 +23,7 @@ class ActionSequencer
17
23
 
18
24
  this.tmp_t = 0;
19
25
 
26
+ /** @type {{[key:string]:any[]}} */
20
27
  this.channels = {};
21
28
 
22
29
  const channel_names = Object.keys(context);
@@ -50,6 +57,9 @@ class ActionSequencer
50
57
  this.elapsed_time = duration;
51
58
  }
52
59
 
60
+ /**
61
+ * @param {number} delta_time
62
+ */
53
63
  update(delta_time)
54
64
  {
55
65
  if (this.playing)
@@ -60,6 +70,9 @@ class ActionSequencer
60
70
  }
61
71
  }
62
72
 
73
+ /**
74
+ * @param {number} time
75
+ */
63
76
  set_progress(time)
64
77
  {
65
78
  this.previous_elapsed_time = this.elapsed_time;
@@ -67,6 +80,9 @@ class ActionSequencer
67
80
  this.__play_clips(this.elapsed_time, this.elapsed_time);
68
81
  }
69
82
 
83
+ /**
84
+ * @param {number} t
85
+ */
70
86
  set_normalized_progress(t)
71
87
  {
72
88
  this.previous_elapsed_time = this.elapsed_time;
@@ -84,6 +100,10 @@ class ActionSequencer
84
100
  return this.elapsed_time > this.get_duration();
85
101
  }
86
102
 
103
+ /**
104
+ * @param {number} trigger_time
105
+ * @param {ActionEvent} action
106
+ */
87
107
  add_action_event(trigger_time, action)
88
108
  {
89
109
  this.action_events.push({
@@ -94,6 +114,12 @@ class ActionSequencer
94
114
  this.duration = Math.max(this.duration, trigger_time);
95
115
  }
96
116
 
117
+ /**
118
+ * @param {number} from
119
+ * @param {number} to
120
+ * @param {ActionInterpolator} interpolator
121
+ * @param {boolean} [use_dynamic_from_value]
122
+ */
97
123
  add_action_interpolator(from, to, interpolator, use_dynamic_from_value = false)
98
124
  {
99
125
  if (use_dynamic_from_value)
@@ -125,6 +151,9 @@ class ActionSequencer
125
151
  this.channels[interpolator.attribute_name].push(keyframe);
126
152
  }
127
153
 
154
+ /**
155
+ * @param {string} name
156
+ */
128
157
  get_current_target_value(name)
129
158
  {
130
159
  const keyframe = this.__get_current_keyframe(name, this.elapsed_time);
@@ -137,6 +166,9 @@ class ActionSequencer
137
166
  return keyframe.interpolator.evaluate(1);
138
167
  }
139
168
 
169
+ /**
170
+ * @param {string} name
171
+ */
140
172
  get_current_starting_value(name)
141
173
  {
142
174
  const keyframe = this.__get_current_keyframe(name, this.elapsed_time);
@@ -144,6 +176,9 @@ class ActionSequencer
144
176
  return keyframe.interpolator.evaluate(0);
145
177
  }
146
178
 
179
+ /**
180
+ * @param {string} name
181
+ */
147
182
  get_current_progress(name)
148
183
  {
149
184
  const keyframe = this.__get_current_keyframe(name, this.elapsed_time);
@@ -157,7 +192,11 @@ class ActionSequencer
157
192
  return this.duration;
158
193
  }
159
194
 
160
- __play_clips(from, to)
195
+ /**
196
+ * @param {number} from
197
+ * @param {number} to
198
+ */
199
+ __play_clips(from, to) // eslint-disable-line no-unused-vars
161
200
  {
162
201
  if (this.elapsed_time > this.previous_elapsed_time)
163
202
  {
@@ -174,6 +213,10 @@ class ActionSequencer
174
213
  }
175
214
  }
176
215
 
216
+ /**
217
+ * @param {number} from
218
+ * @param {number} to
219
+ */
177
220
  __play_events(from, to)
178
221
  {
179
222
  for (let i = 0; i < this.action_events.length; i++)
@@ -187,6 +230,10 @@ class ActionSequencer
187
230
  }
188
231
  }
189
232
 
233
+ /**
234
+ * @param {any} keyframe
235
+ * @param {number} time
236
+ */
190
237
  evaluate_keyframe(keyframe, time)
191
238
  {
192
239
  this.tmp_t = this.__linear_map_01(time, keyframe.from, keyframe.to);
@@ -194,11 +241,17 @@ class ActionSequencer
194
241
  return keyframe.interpolator.evaluate(OMath.clamp(this.tmp_t, 0, 1));
195
242
  }
196
243
 
244
+ /**
245
+ * @param {string} channel_name
246
+ */
197
247
  get_keyframes(channel_name)
198
248
  {
199
249
  return this.channels[channel_name];
200
250
  }
201
251
 
252
+ /**
253
+ * @param {string} channel_name
254
+ */
202
255
  is_channel_redefined(channel_name)
203
256
  {
204
257
  for (let i = 0; i < this.channels[channel_name].length; i++)
@@ -214,6 +267,12 @@ class ActionSequencer
214
267
  return true;
215
268
  }
216
269
 
270
+ /**
271
+ * @param {number} value
272
+ * @param {number} from_range_start_value
273
+ * @param {number} from_range_end_value
274
+ * @returns {number}
275
+ */
217
276
  __linear_map_01(value,
218
277
  from_range_start_value,
219
278
  from_range_end_value)
@@ -221,6 +280,10 @@ class ActionSequencer
221
280
  return OMath.saturate(((value - from_range_start_value) / (from_range_end_value - from_range_start_value)) * (1 - 0) + 0);
222
281
  }
223
282
 
283
+ /**
284
+ * @param {string} channel_name
285
+ * @param {number} time
286
+ */
224
287
  __get_current_keyframe(channel_name, time)
225
288
  {
226
289
  let current = undefined;
@@ -1,8 +1,16 @@
1
+ // @ts-check
1
2
  import { ActionInterpolator } from './ActionInterpolator';
2
3
  import { OMath } from '../utilities/OMath';
3
4
 
4
5
  class NumberInterpolator extends ActionInterpolator
5
6
  {
7
+ /**
8
+ * @param {string} attribute_name
9
+ * @param {number} [from]
10
+ * @param {number} [to]
11
+ * @param {boolean} [initial]
12
+ * @param {import('../utilities/EasingFunctions').EasingFunctionType | function} [easing_function]
13
+ */
6
14
  constructor(attribute_name, from = 0, to = 1, initial = false, easing_function = 'linear')
7
15
  {
8
16
  super(easing_function);
@@ -13,11 +21,18 @@ class NumberInterpolator extends ActionInterpolator
13
21
  this.initial = initial;
14
22
  }
15
23
 
24
+ /**
25
+ * @param {any} context
26
+ * @param {number} t
27
+ */
16
28
  update(context, t)
17
29
  {
18
30
  context[this.attribute_name] = OMath.lerp(this.from, this.to, this.easing_function(t));
19
31
  }
20
32
 
33
+ /**
34
+ * @param {number} t
35
+ */
21
36
  evaluate(t)
22
37
  {
23
38
  return OMath.lerp(this.from, this.to, this.easing_function(t));
@@ -1,8 +1,16 @@
1
+ // @ts-check
2
+ import { Vector3 } from 'three';
1
3
  import { ActionInterpolator } from './ActionInterpolator';
2
4
 
3
5
  class VectorInterpolator extends ActionInterpolator
4
6
  {
5
- constructor(attribute_name, from = 0, to = 1, easing_function = 'linear')
7
+ /**
8
+ * @param {string} attribute_name
9
+ * @param {Vector3} [from]
10
+ * @param {Vector3} [to]
11
+ * @param {import('../utilities/EasingFunctions').EasingFunctionType | function} [easing_function]
12
+ */
13
+ constructor(attribute_name, from = new Vector3(), to = new Vector3(1, 1, 1), easing_function = 'linear')
6
14
  {
7
15
  super(easing_function);
8
16
 
@@ -11,6 +19,10 @@ class VectorInterpolator extends ActionInterpolator
11
19
  this.to = to;
12
20
  }
13
21
 
22
+ /**
23
+ * @param {any} context
24
+ * @param {number} t
25
+ */
14
26
  update(context, t)
15
27
  {
16
28
  const tmp = this.from.clone();
@@ -1,3 +1,4 @@
1
+ // @ts-check
1
2
  import { MedianFilter } from './render_utilities/MedianFilter';
2
3
  import { GaussianBlurrer } from './render_utilities/GaussianBlurrer';
3
4
  import { Blurrer } from './render_utilities/Blurrer';
@@ -1,3 +1,4 @@
1
+ // @ts-check
1
2
  import { CanvasTexture } from 'three';
2
3
  import { Vector2 } from 'three';
3
4
  import { UVMapping } from 'three';
@@ -6,9 +7,12 @@ import { NearestFilter } from 'three';
6
7
 
7
8
  class CanvasDrawer
8
9
  {
10
+ /**
11
+ * @param {boolean} [uses_dynamic_font]
12
+ */
9
13
  constructor(uses_dynamic_font)
10
14
  {
11
- this.uses_dynamic_font = uses_dynamic_font;
15
+ this.uses_dynamic_font = !!uses_dynamic_font;
12
16
  this.__textHeight = null;
13
17
 
14
18
  this.canvas = document.createElement('canvas');
@@ -31,6 +35,10 @@ class CanvasDrawer
31
35
  return this.__textHeight;
32
36
  }
33
37
 
38
+ /**
39
+ * @param {string} text
40
+ * @param {string} font
41
+ */
34
42
  get_text_size(text, font = '24px Arial')
35
43
  {
36
44
  const size = new Vector2();
@@ -40,6 +48,10 @@ class CanvasDrawer
40
48
  return size;
41
49
  }
42
50
 
51
+ /**
52
+ * @param {string} text
53
+ * @param {any} [ctxOptions]
54
+ */
43
55
  draw_canvas(text, ctxOptions = {})
44
56
  {
45
57
  ctxOptions.font = ctxOptions.font || '24px Arial';
@@ -49,6 +61,10 @@ class CanvasDrawer
49
61
  return this.canvas;
50
62
  }
51
63
 
64
+ /**
65
+ * @param {string} text
66
+ * @param {any} [ctxOptions]
67
+ */
52
68
  draw_on_texture(text, ctxOptions)
53
69
  {
54
70
  const canvas = this.draw_canvas(text, ctxOptions);
@@ -57,15 +73,31 @@ class CanvasDrawer
57
73
  ClampToEdgeWrapping,
58
74
  NearestFilter,
59
75
  NearestFilter);
60
- canvas_texture.generateMipMaps = false;
76
+ canvas_texture.generateMipmaps = false;
61
77
  canvas_texture.needsUpdate = true;
62
78
 
63
79
  return canvas_texture;
64
80
  }
65
81
 
66
- __draw(text, ctxOptions)
82
+ /**
83
+ * @param {string[] | string} text
84
+ * @param {any} [ctxOptions]
85
+ * @param {HTMLCanvasElement} [canvas]
86
+ * @param {CanvasRenderingContext2D} [ctx]
87
+ */
88
+ __draw(text, ctxOptions, canvas, ctx) // eslint-disable-line no-unused-vars
67
89
  {}
68
90
 
91
+ /**
92
+ * @param {CanvasRenderingContext2D} ctx
93
+ * @param {number} x
94
+ * @param {number} y
95
+ * @param {number} width
96
+ * @param {number} height
97
+ * @param {number | {tl:number, tr:number, br:number, bl:number}} radius
98
+ * @param {boolean} fill
99
+ * @param {boolean} stroke
100
+ */
69
101
  roundRect(ctx, x, y, width, height, radius, fill, stroke)
70
102
  {
71
103
  if (typeof stroke === 'undefined')
@@ -85,7 +117,8 @@ class CanvasDrawer
85
117
  const defaultRadius = { tl: 0, tr: 0, br: 0, bl: 0 };
86
118
  for (const side in defaultRadius)
87
119
  {
88
- radius[side] = radius[side] || defaultRadius[side];
120
+ const _side = /** @type {keyof typeof defaultRadius} */ (side);
121
+ radius[_side] = radius[_side] || defaultRadius[_side];
89
122
  }
90
123
  }
91
124
  ctx.beginPath();
@@ -1,3 +1,4 @@
1
+ // @ts-check
1
2
  import { CanvasDrawer } from './CanvasDrawer';
2
3
 
3
4
  import { Vector2 } from 'three';
@@ -10,6 +11,12 @@ class MultiLineTextDrawer extends CanvasDrawer
10
11
  this.text_margin = new Vector2(2, 0);
11
12
  }
12
13
 
14
+ /**
15
+ * @param {string[]} text_array
16
+ * @param {any} [ctxOptions]
17
+ * @param {HTMLCanvasElement} [canvas]
18
+ * @param {CanvasRenderingContext2D} [ctx]
19
+ */
13
20
  __draw(text_array, ctxOptions, canvas, ctx)
14
21
  {
15
22
  ctx.font = ctxOptions.font;
@@ -37,7 +44,7 @@ class MultiLineTextDrawer extends CanvasDrawer
37
44
  ctx.font = ctxOptions.font;
38
45
  ctx.fillStyle = ctxOptions.font_color;
39
46
  ctx.textBaseline = 'middle';
40
- ctx.textAlignment = 'left';
47
+ ctx.textAlign = 'left';
41
48
 
42
49
  const word_height = canvas.height / text_array.length;
43
50
  for (let i = 0; i < text_array.length; i++)
@@ -1,4 +1,4 @@
1
-
1
+ // @ts-check
2
2
  import { CanvasDrawer } from './CanvasDrawer';
3
3
 
4
4
  import { Vector2 } from 'three';
@@ -11,6 +11,12 @@ class SimpleTextDrawer extends CanvasDrawer
11
11
  this.text_margin = new Vector2(2, 0);
12
12
  }
13
13
 
14
+ /**
15
+ * @param {string} text
16
+ * @param {any} [ctxOptions]
17
+ * @param {HTMLCanvasElement} [canvas]
18
+ * @param {CanvasRenderingContext2D} [ctx]
19
+ */
14
20
  __draw(text, ctxOptions, canvas, ctx)
15
21
  {
16
22
  ctx.font = ctxOptions.font;
@@ -1,8 +1,15 @@
1
- import { Audio as TAudio } from 'three';
1
+ // @ts-check
2
+ import { AudioListener, Audio as TAudio } from 'three'; // eslint-disable-line no-unused-vars
2
3
  import { PositionalAudio as TPositionalAudio } from 'three';
3
4
 
4
5
  class AudioClip
5
6
  {
7
+ /**
8
+ * @param {AudioBuffer} buffer
9
+ * @param {boolean} [loop]
10
+ * @param {number} [volume]
11
+ * @param {boolean} [positional]
12
+ */
6
13
  constructor(buffer, loop = true, volume = 1, positional = false)
7
14
  {
8
15
  this.buffer = buffer;
@@ -13,6 +20,9 @@ class AudioClip
13
20
  this.audio = undefined;
14
21
  }
15
22
 
23
+ /**
24
+ * @param {AudioListener} audio_listener
25
+ */
16
26
  init(audio_listener)
17
27
  {
18
28
  if (this.positional)
@@ -1,4 +1,4 @@
1
-
1
+ // @ts-check
2
2
  import { Object3D } from 'three';
3
3
  import { LineBasicMaterial } from 'three';
4
4
  import { AlwaysDepth } from 'three';
@@ -1,5 +1,5 @@
1
-
2
- import { Object3D } from 'three';
1
+ // @ts-check
2
+ import { Mesh, Object3D } from 'three'; // eslint-disable-line no-unused-vars
3
3
  import { Vector3 } from 'three';
4
4
 
5
5
  class BaseObject extends Object3D
@@ -16,6 +16,9 @@ class BaseObject extends Object3D
16
16
  return this.___temp_w_pos;
17
17
  }
18
18
 
19
+ /**
20
+ * @param {Object3D | Mesh} obj
21
+ */
19
22
  deep_dispose(obj)
20
23
  {
21
24
  if (obj !== null)
@@ -24,13 +27,13 @@ class BaseObject extends Object3D
24
27
  {
25
28
  this.deep_dispose(obj.children[i]);
26
29
  }
27
- if (obj.geometry)
30
+ if ('geometry' in obj)
28
31
  {
29
32
  obj.geometry.dispose();
30
33
  }
31
- if (obj.material)
34
+ if ('material' in obj)
32
35
  {
33
- if (obj.material.map)
36
+ if ('map' in obj.material)
34
37
  {
35
38
  obj.material.map.dispose();
36
39
  }
@@ -1,14 +1,25 @@
1
+ // @ts-check
2
+ // @ts-ignore
1
3
  import corners_frag from '../shaders/edges/corners.frag';
4
+ // @ts-ignore
2
5
  import corners_vert from '../shaders/edges/corners.vert';
6
+ // @ts-ignore
3
7
  import edge_line_frag from '../shaders/edges/edges.frag';
8
+ // @ts-ignore
4
9
  import edge_line_vert from '../shaders/edges/edges.vert';
5
10
 
6
11
  import * as BufferGeometryUtils from 'three/examples/jsm/utils/BufferGeometryUtils.js';
7
12
 
8
- import { BufferAttribute, Color, EdgesGeometry, LineBasicMaterial, LineSegments, Mesh, Object3D, PlaneGeometry, ShaderMaterial, Vector3 } from 'three';
13
+ // eslint-disable-next-line no-unused-vars
14
+ import { BufferAttribute, BufferGeometry, Color, EdgesGeometry, InterleavedBufferAttribute, LineBasicMaterial, LineSegments, Mesh, Object3D, PlaneGeometry, ShaderMaterial, Vector3 } from 'three';
9
15
 
10
16
  class EdgeMesh extends Object3D
11
17
  {
18
+ /**
19
+ * @param {BufferGeometry} buffer_geometry
20
+ * @param {number} [thickness]
21
+ * @param {string} [color]
22
+ */
12
23
  constructor(buffer_geometry, thickness, color)
13
24
  {
14
25
  super();
@@ -48,6 +59,10 @@ class EdgeMesh extends Object3D
48
59
  this.add(this.corners_mesh);
49
60
  }
50
61
 
62
+ /**
63
+ * @param {BufferGeometry} cube_geometry
64
+ * @returns {Vector3[]}
65
+ */
51
66
  __get_edges(cube_geometry)
52
67
  {
53
68
  const edges = new EdgesGeometry(cube_geometry);
@@ -62,11 +77,17 @@ class EdgeMesh extends Object3D
62
77
  return points;
63
78
  }
64
79
 
65
- update(TIME)
80
+ /**
81
+ * @param {number} TIME
82
+ */
83
+ update(TIME) // eslint-disable-line no-unused-vars
66
84
  {
67
85
 
68
86
  }
69
87
 
88
+ /**
89
+ * @param {Vector3[]} points
90
+ */
70
91
  __get_edges_geometry(points)
71
92
  {
72
93
  const buffer_geometries = [];
@@ -108,6 +129,10 @@ class EdgeMesh extends Object3D
108
129
  return BufferGeometryUtils.mergeGeometries(buffer_geometries);
109
130
  }
110
131
 
132
+ /**
133
+ * @param {BufferAttribute | InterleavedBufferAttribute} geometry_vertices
134
+ * @returns {BufferGeometry}
135
+ */
111
136
  __get_corners_geometry(geometry_vertices)
112
137
  {
113
138
  const circle_buffer_geometries = [];
@@ -129,6 +154,9 @@ class EdgeMesh extends Object3D
129
154
  return BufferGeometryUtils.mergeGeometries(circle_buffer_geometries);
130
155
  }
131
156
 
157
+ /**
158
+ * @param {boolean} boolean
159
+ */
132
160
  set_visible(boolean)
133
161
  {
134
162
  this.edges_mesh.visible = boolean;
@@ -1,14 +1,21 @@
1
+ // @ts-check
2
+ // @ts-ignore
1
3
  import edge_visualizer_frag from '../shaders/edge_visualizer/edge_visualizer.frag';
4
+ // @ts-ignore
2
5
  import edge_visualizer_vert from '../shaders/edge_visualizer/edge_visualizer.vert';
3
6
 
4
7
  import { GeometryUtilities } from '../utilities/GeometryUtilities';
5
8
 
6
- import { Mesh } from 'three';
9
+ import { BufferGeometry, Mesh } from 'three'; // eslint-disable-line no-unused-vars
7
10
  import { Color } from 'three';
8
11
  import { ShaderMaterial } from 'three';
9
12
 
10
13
  class GeometryEdgeVisualizer extends Mesh
11
14
  {
15
+ /**
16
+ * @param {BufferGeometry} geometry
17
+ * @param {string | number} [line_color]
18
+ */
12
19
  constructor(geometry, line_color)
13
20
  {
14
21
  line_color = line_color || '#91EE91';
@@ -23,6 +30,7 @@ class GeometryEdgeVisualizer extends Mesh
23
30
  },
24
31
  vertexShader: edge_visualizer_vert,
25
32
  fragmentShader: edge_visualizer_frag,
33
+ // @ts-ignore
26
34
  extensions: { derivatives: true },
27
35
  transparent: true,
28
36
  depthWrite: false
@@ -37,6 +45,7 @@ class GeometryEdgeVisualizer extends Mesh
37
45
  GeometryUtilities.add_barycentric_attribute(non_indexed_geometry);
38
46
 
39
47
  super(non_indexed_geometry, material);
48
+ this.material = material;
40
49
  }
41
50
 
42
51
  hide_faces()
@@ -1,4 +1,7 @@
1
+ // @ts-check
2
+ // @ts-ignore
1
3
  import grid_frag from '../shaders/grid/grid.frag';
4
+ // @ts-ignore
2
5
  import grid_vert from '../shaders/grid/grid.vert';
3
6
 
4
7
  import { GeometryUtilities } from '../utilities/GeometryUtilities';
@@ -18,6 +21,7 @@ class Grid extends Mesh
18
21
  },
19
22
  vertexShader: grid_vert,
20
23
  fragmentShader: grid_frag,
24
+ // @ts-ignore
21
25
  extensions: { derivatives: true },
22
26
  transparent: true,
23
27
  depthWrite: false
@@ -1,7 +1,10 @@
1
+ // @ts-check
2
+ // @ts-ignore
1
3
  import line_vs from '../shaders/basic_line/basic_line.vert';
4
+ // @ts-ignore
2
5
  import line_fs from '../shaders/basic_line/basic_line.frag';
3
6
 
4
- import { Mesh } from 'three';
7
+ import { Mesh, Vector3 } from 'three'; // eslint-disable-line no-unused-vars
5
8
  import { BufferAttribute } from 'three';
6
9
  import { BufferGeometry } from 'three';
7
10
  import { ShaderMaterial } from 'three';
@@ -9,6 +12,9 @@ import { Color } from 'three';
9
12
 
10
13
  class Line extends Mesh
11
14
  {
15
+ /**
16
+ * @param {Vector3[]} [points]
17
+ */
12
18
  constructor(points)
13
19
  {
14
20
  const geometry = new BufferGeometry();
@@ -29,18 +35,22 @@ class Line extends Mesh
29
35
  fragmentShader: line_fs,
30
36
  transparent: true,
31
37
  depthWrite: false,
38
+ // @ts-ignore
32
39
  extensions: { derivatives: true }
33
40
 
34
41
  });
35
42
 
36
43
  super(geometry, material);
37
-
44
+ this.material = material;
38
45
  if (points)
39
46
  {
40
47
  this.setup(points);
41
48
  }
42
49
  }
43
50
 
51
+ /**
52
+ * @param {Vector3[]} points
53
+ */
44
54
  setup(points)
45
55
  {
46
56
  const vertices = [];
@@ -108,11 +118,11 @@ class Line extends Mesh
108
118
  }
109
119
 
110
120
  this.geometry.setIndex(indices);
111
- this.geometry.getAttribute('position').copy(new BufferAttribute(vertexList, 3));
112
- this.geometry.getAttribute('next_position').copy(new BufferAttribute(nextPositionList, 3));
113
- this.geometry.getAttribute('previous_position').copy(new BufferAttribute(previousPositionList, 3));
114
- this.geometry.getAttribute('orientation').copy(new BufferAttribute(orientationList, 1));
115
- this.geometry.getAttribute('coverage').copy(new BufferAttribute(coverageList, 1));
121
+ /** @type {BufferAttribute} */(this.geometry.getAttribute('position')).copy(new BufferAttribute(vertexList, 3));
122
+ /** @type {BufferAttribute} */(this.geometry.getAttribute('next_position')).copy(new BufferAttribute(nextPositionList, 3));
123
+ /** @type {BufferAttribute} */(this.geometry.getAttribute('previous_position')).copy(new BufferAttribute(previousPositionList, 3));
124
+ /** @type {BufferAttribute} */(this.geometry.getAttribute('orientation')).copy(new BufferAttribute(orientationList, 1));
125
+ /** @type {BufferAttribute} */(this.geometry.getAttribute('coverage')).copy(new BufferAttribute(coverageList, 1));
116
126
 
117
127
  this.geometry.getAttribute('position').needsUpdate = true;
118
128
  this.geometry.getAttribute('next_position').needsUpdate = true;
@@ -122,6 +132,7 @@ class Line extends Mesh
122
132
 
123
133
  this.material.uniforms._Length.value = accumulated_length;
124
134
  this._length = accumulated_length;
135
+ this.accumulated_length = accumulated_length;
125
136
  }
126
137
 
127
138
  set thickness(value)
@@ -134,6 +145,11 @@ class Line extends Mesh
134
145
  return this.material.uniforms._Thickness.value;
135
146
  }
136
147
 
148
+ /**
149
+ * @param {Vector3[]} points
150
+ * @param {number} i
151
+ * @returns {Vector3}
152
+ */
137
153
  __get_previous_position(points, i)
138
154
  {
139
155
  if (i === 0)
@@ -146,6 +162,11 @@ class Line extends Mesh
146
162
  }
147
163
  }
148
164
 
165
+ /**
166
+ * @param {Vector3[]} points
167
+ * @param {number} i
168
+ * @returns {Vector3}
169
+ */
149
170
  __get_next_position(points, i)
150
171
  {
151
172
  if (i === points.length - 1)
@@ -192,6 +213,9 @@ class Line extends Mesh
192
213
  return this.material.uniforms._Color.value;
193
214
  }
194
215
 
216
+ /**
217
+ * @param {Color} col
218
+ */
195
219
  copy_color(col)
196
220
  {
197
221
  this.material.uniforms._Color.value.copy(col);