ohzi-core 12.2.0 → 12.3.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.
Files changed (285) hide show
  1. package/build/index.mjs +1 -1
  2. package/build/index.mjs.map +1 -1
  3. package/package.json +2 -1
  4. package/src/BaseApplication.js +11 -2
  5. package/src/Browser.js +10 -3
  6. package/src/CameraManager.js +5 -0
  7. package/src/Capabilities.js +1 -0
  8. package/src/CustomBezierCurve.js +12 -0
  9. package/src/Debug.js +99 -5
  10. package/src/Graphics.js +86 -6
  11. package/src/Initializer.js +5 -0
  12. package/src/KeyboardInput.js +40 -1
  13. package/src/OS.js +1 -1
  14. package/src/OScreen.js +19 -4
  15. package/src/OrthographicCamera.js +13 -0
  16. package/src/PerspectiveCamera.js +11 -0
  17. package/src/ReflectionPlaneContext.js +5 -1
  18. package/src/RenderLayers.js +1 -1
  19. package/src/RenderLoop.js +9 -0
  20. package/src/RenderOrder.js +1 -1
  21. package/src/ResourceContainer.js +21 -0
  22. package/src/SceneManager.js +14 -4
  23. package/src/Screen.js +71 -0
  24. package/src/Time.js +4 -0
  25. package/src/UI.js +16 -1
  26. package/src/action_sequencer/ActionEvent.js +6 -1
  27. package/src/action_sequencer/ActionInterpolator.js +16 -2
  28. package/src/action_sequencer/ActionSequencer.js +65 -2
  29. package/src/action_sequencer/NumberInterpolator.js +15 -0
  30. package/src/action_sequencer/VectorInterpolator.js +13 -1
  31. package/src/blitter_index.js +1 -0
  32. package/src/canvas_drawer/CanvasDrawer.js +37 -4
  33. package/src/canvas_drawer/MultiLineTextDrawer.js +8 -1
  34. package/src/canvas_drawer/SimpleTextDrawer.js +7 -1
  35. package/src/components/AudioClip.js +11 -1
  36. package/src/components/AxisHelper.js +1 -1
  37. package/src/components/BaseObject.js +8 -5
  38. package/src/components/EdgeMesh.js +30 -2
  39. package/src/components/GeometryEdgeVisualizer.js +10 -1
  40. package/src/components/Grid.js +4 -0
  41. package/src/components/Line.js +31 -7
  42. package/src/components/MultiLinePath.js +9 -5
  43. package/src/components/MultiLineText2D.js +13 -2
  44. package/src/components/ObjectAxis.js +5 -0
  45. package/src/components/ObjectOrientedBoundingBox.js +26 -1
  46. package/src/components/PlaneHelper.js +1 -1
  47. package/src/components/Shape2D.js +11 -3
  48. package/src/components/Shape3D.js +10 -4
  49. package/src/components/Text2D.js +11 -3
  50. package/src/components/UIElement.js +40 -4
  51. package/src/components/UpdatableMaterialMesh.js +11 -3
  52. package/src/components/WorldImage.js +10 -2
  53. package/src/index.js +3 -1
  54. package/src/loaders/AsyncAbstractLoader.js +16 -0
  55. package/src/loaders/AsyncObjectsLoader.js +6 -0
  56. package/src/materials/AddMaterial.js +2 -2
  57. package/src/materials/GaussianBlurMaterial.js +9 -1
  58. package/src/materials/LuminosityHighPassMaterial.js +8 -1
  59. package/src/materials/UnrealBloomComposeMaterial.js +3 -2
  60. package/src/primitives/Arrow.js +6 -0
  61. package/src/primitives/Cube.js +6 -1
  62. package/src/primitives/HorizontalPlane.js +8 -1
  63. package/src/primitives/Sphere.js +7 -0
  64. package/src/primitives/VerticalPlane.js +8 -1
  65. package/src/render_mode/UnrealBloomRender.js +47 -38
  66. package/src/render_utilities/Blitter.js +3 -3
  67. package/src/render_utilities/GaussianBlurrer.js +33 -14
  68. package/src/shaders/add/add.frag +21 -2
  69. package/src/shaders/gaussian_blur/gaussian_blur.frag +23 -4
  70. package/src/shaders/gaussian_blur/unreal_bloom_compose.frag +17 -5
  71. package/src/shaders/luminosity_high_pass/luminosity_high_pass.frag +16 -1
  72. package/src/ui/ui_element_state/OnIdle.js +5 -0
  73. package/src/ui/ui_element_state/OnMouseEnter.js +11 -0
  74. package/src/ui/ui_element_state/OnMouseExit.js +5 -0
  75. package/src/ui/ui_element_state/OnMouseHover.js +13 -0
  76. package/src/ui/ui_element_state/UIElementState.js +17 -3
  77. package/src/utilities/EasingFunctions.js +5 -0
  78. package/types/BaseApplication.d.ts +18 -11
  79. package/types/Browser.d.ts +20 -19
  80. package/types/CameraManager.d.ts +14 -13
  81. package/types/Capabilities.d.ts +8 -8
  82. package/types/CustomBezierCurve.d.ts +19 -7
  83. package/types/Debug.d.ts +198 -37
  84. package/types/Graphics.d.ts +143 -61
  85. package/types/Initializer.d.ts +10 -6
  86. package/types/KeyboardInput.d.ts +65 -20
  87. package/types/OS.d.ts +20 -20
  88. package/types/OScreen.d.ts +37 -22
  89. package/types/OrthographicCamera.d.ts +20 -6
  90. package/types/PerspectiveCamera.d.ts +18 -6
  91. package/types/ReflectionPlaneContext.d.ts +13 -8
  92. package/types/RenderLayers.d.ts +6 -6
  93. package/types/RenderLoop.d.ts +132 -14
  94. package/types/RenderOrder.d.ts +8 -8
  95. package/types/ResourceContainer.d.ts +29 -10
  96. package/types/SceneManager.d.ts +15 -12
  97. package/types/Screen.d.ts +27 -0
  98. package/types/Time.d.ts +29 -24
  99. package/types/UI.d.ts +92 -18
  100. package/types/action_sequencer/ActionEvent.d.ts +12 -7
  101. package/types/action_sequencer/ActionInterpolator.d.ts +18 -5
  102. package/types/action_sequencer/ActionSequencer.d.ts +104 -36
  103. package/types/action_sequencer/NumberInterpolator.d.ts +18 -9
  104. package/types/action_sequencer/VectorInterpolator.d.ts +13 -7
  105. package/types/blitter_index.d.ts +6 -6
  106. package/types/canvas_drawer/CanvasDrawer.d.ts +51 -13
  107. package/types/canvas_drawer/MultiLineTextDrawer.d.ts +13 -5
  108. package/types/canvas_drawer/SimpleTextDrawer.d.ts +13 -6
  109. package/types/components/AudioClip.d.ts +25 -13
  110. package/types/components/AxisHelper.d.ts +6 -6
  111. package/types/components/BaseObject.d.ts +12 -5
  112. package/types/components/EdgeMesh.d.ts +42 -13
  113. package/types/components/GeometryEdgeVisualizer.d.ts +12 -4
  114. package/types/components/Grid.d.ts +4 -2
  115. package/types/components/Line.d.ts +42 -16
  116. package/types/components/MultiLinePath.d.ts +10 -4
  117. package/types/components/MultiLineText2D.d.ts +22 -10
  118. package/types/components/ObjectAxis.d.ts +8 -3
  119. package/types/components/ObjectOrientedBoundingBox.d.ts +45 -18
  120. package/types/components/PlaneHelper.d.ts +6 -6
  121. package/types/components/Shape2D.d.ts +14 -4
  122. package/types/components/Shape3D.d.ts +10 -3
  123. package/types/components/Text2D.d.ts +21 -13
  124. package/types/components/UIElement.d.ts +87 -52
  125. package/types/components/UpdatableMaterialMesh.d.ts +12 -4
  126. package/types/components/WorldImage.d.ts +23 -13
  127. package/types/components/mouse_interactors/ObjectRotator.d.ts +12 -0
  128. package/types/components/sdf_text/SDFText.d.ts +35 -30
  129. package/types/components/sdf_text/SDFTextBatch.d.ts +12 -12
  130. package/types/components/sdf_text/TextGlyph.d.ts +8 -6
  131. package/types/data_textures/CustomDataTexture.d.ts +11 -11
  132. package/types/data_textures/RGBADataTexture.d.ts +4 -4
  133. package/types/data_textures/RGBAFloatDataTexture.d.ts +4 -4
  134. package/types/data_textures/RGBDataTexture.d.ts +4 -4
  135. package/types/data_textures/RGBFloatDataTexture.d.ts +4 -4
  136. package/types/editor/ManipulatorHandle.d.ts +23 -14
  137. package/types/editor/ObjectEditor.d.ts +18 -16
  138. package/types/editor/ObjectManipulator.d.ts +23 -19
  139. package/types/editor/ObjectPicker.d.ts +19 -16
  140. package/types/gpu_particles/GPUParticleSystem.d.ts +22 -15
  141. package/types/gpu_particles/ParticleAttribute.d.ts +19 -18
  142. package/types/gpu_particles/ParticlePositionAttribute.d.ts +6 -6
  143. package/types/html_utilities/CSSAnimator.d.ts +31 -31
  144. package/types/html_utilities/css_animator_states/Animating.d.ts +8 -8
  145. package/types/html_utilities/css_animator_states/Idle.d.ts +6 -6
  146. package/types/index.d.ts +110 -108
  147. package/types/loaders/AsyncAbstractLoader.d.ts +41 -27
  148. package/types/loaders/AsyncAudiosLoader.d.ts +6 -5
  149. package/types/loaders/AsyncObjectsLoader.d.ts +6 -6
  150. package/types/loaders/AsyncTexturesLoader.d.ts +9 -8
  151. package/types/loaders/assets_loader/AssetLoader.d.ts +4 -0
  152. package/types/loaders/assets_loader/AsyncAssetsLoaderWorker.d.ts +1 -0
  153. package/types/loaders/assets_loader/ResourceBatch.d.ts +14 -0
  154. package/types/loaders/assets_loader/ResourceContainer.d.ts +9 -0
  155. package/types/loaders/assets_loader/ResourceLoaderChecker.d.ts +8 -0
  156. package/types/materials/AddMaterial.d.ts +5 -5
  157. package/types/materials/AlphaFilterMaterial.d.ts +6 -6
  158. package/types/materials/BaseShaderMaterial.d.ts +4 -3
  159. package/types/materials/BlitMaterial.d.ts +4 -3
  160. package/types/materials/BloomComposeMaterial.d.ts +4 -7
  161. package/types/materials/BoxBlurMaterial.d.ts +4 -4
  162. package/types/materials/ClearAlphaMaterial.d.ts +3 -3
  163. package/types/materials/ClearColorMaterial.d.ts +7 -7
  164. package/types/materials/ClearDepthNormalMaterial.d.ts +4 -4
  165. package/types/materials/DeferredRendererComposeMaterial.d.ts +7 -7
  166. package/types/materials/DepthNormalMaterial.d.ts +6 -4
  167. package/types/materials/DisplayNormalTextureMaterial.d.ts +4 -4
  168. package/types/materials/DualFilteringBlurMaterial.d.ts +4 -4
  169. package/types/materials/FXAAMaterial.d.ts +3 -3
  170. package/types/materials/GaussianBlurMaterial.d.ts +6 -6
  171. package/types/materials/LuminosityHighPassMaterial.d.ts +4 -4
  172. package/types/materials/MedianFilterMaterial.d.ts +7 -6
  173. package/types/materials/NormalMaterial.d.ts +4 -2
  174. package/types/materials/SDFScreenTextMaterial.d.ts +9 -11
  175. package/types/materials/SDFTextMaterial.d.ts +10 -12
  176. package/types/materials/SSAOComposeMaterial.d.ts +4 -4
  177. package/types/materials/SSAOMaterial.d.ts +8 -6
  178. package/types/materials/ScreenSpaceTextureMaterial.d.ts +7 -7
  179. package/types/materials/UIElementMaterial.d.ts +4 -7
  180. package/types/materials/UnrealBloomComposeMaterial.d.ts +16 -16
  181. package/types/materials/UnrealBlurMaterial.d.ts +4 -4
  182. package/types/materials/UnrealComposeMaterial.d.ts +4 -4
  183. package/types/materials/ViewPositionMaterial.d.ts +4 -3
  184. package/types/materials/deferred/DeferredPointLightMaterial.d.ts +9 -10
  185. package/types/materials/gpu_particles/AttributeUpdateMaterial.d.ts +7 -0
  186. package/types/materials/gpu_particles/BasicParticleMaterial.d.ts +4 -0
  187. package/types/materials/gpu_particles/ParticleStorageMaterial.d.ts +4 -2
  188. package/types/materials/gpu_particles/PositionStorageMaterial.d.ts +3 -4
  189. package/types/object_pool/Pool.d.ts +10 -10
  190. package/types/primitives/Arrow.d.ts +15 -8
  191. package/types/primitives/Cube.d.ts +10 -3
  192. package/types/primitives/HorizontalPlane.d.ts +11 -3
  193. package/types/primitives/Sphere.d.ts +11 -3
  194. package/types/primitives/VerticalPlane.d.ts +11 -3
  195. package/types/raycast/GroupRaycaster.d.ts +15 -13
  196. package/types/raycast/PlaneDragResolver.d.ts +16 -15
  197. package/types/raycast/PlaneRaycastResolver.d.ts +5 -5
  198. package/types/raycast/PlaneRaycaster.d.ts +9 -7
  199. package/types/raycast/RaycastResolver.d.ts +5 -5
  200. package/types/raycast/SurfaceDragResolver.d.ts +15 -13
  201. package/types/raycast/states/BaseState.d.ts +5 -5
  202. package/types/raycast/states/IdleState.d.ts +3 -5
  203. package/types/raycast/states/OnRaycastEnter.d.ts +3 -5
  204. package/types/raycast/states/OnRaycastExit.d.ts +3 -4
  205. package/types/raycast/states/OnRaycastHover.d.ts +3 -5
  206. package/types/render_mode/BaseRender.d.ts +7 -7
  207. package/types/render_mode/BloomRender.d.ts +12 -10
  208. package/types/render_mode/DebugNormalsRender.d.ts +3 -3
  209. package/types/render_mode/DeferredRender.d.ts +13 -9
  210. package/types/render_mode/NormalAORender.d.ts +18 -17
  211. package/types/render_mode/NormalRender.d.ts +3 -3
  212. package/types/render_mode/OutlineRender.d.ts +25 -20
  213. package/types/render_mode/PlanarReflectionsRender.d.ts +19 -13
  214. package/types/render_mode/UnrealBloomRender.d.ts +21 -20
  215. package/types/render_mode/VRRender.d.ts +4 -4
  216. package/types/render_utilities/Blitter.d.ts +19 -15
  217. package/types/render_utilities/Blurrer.d.ts +9 -8
  218. package/types/render_utilities/DepthAndNormalsRenderer.d.ts +11 -10
  219. package/types/render_utilities/DualFilteringBlurrer.d.ts +18 -17
  220. package/types/render_utilities/GaussianBlurrer.d.ts +27 -26
  221. package/types/render_utilities/MedianFilter.d.ts +11 -9
  222. package/types/render_utilities/ViewPositionRenderer.d.ts +10 -9
  223. package/types/resource_loader/AbstractLoader.d.ts +21 -21
  224. package/types/resource_loader/AsyncTextureLoader.d.ts +11 -11
  225. package/types/resource_loader/AudioLoader.d.ts +9 -9
  226. package/types/resource_loader/BasisLoader.d.ts +6 -6
  227. package/types/resource_loader/CubemapLoader.d.ts +8 -7
  228. package/types/resource_loader/DAELoader.d.ts +7 -6
  229. package/types/resource_loader/DDSLoader.d.ts +7 -6
  230. package/types/resource_loader/FileLoader.d.ts +7 -6
  231. package/types/resource_loader/FontLoader.d.ts +7 -6
  232. package/types/resource_loader/GLTFDRACOLoader.d.ts +7 -6
  233. package/types/resource_loader/GLTFLoader.d.ts +7 -6
  234. package/types/resource_loader/HDRCubeTextureLoader.d.ts +8 -7
  235. package/types/resource_loader/JSONLoader.d.ts +5 -4
  236. package/types/resource_loader/OBJLoader.d.ts +7 -6
  237. package/types/resource_loader/PointArrayLoader.d.ts +9 -7
  238. package/types/resource_loader/RGBETextureLoader.d.ts +7 -6
  239. package/types/resource_loader/ResourceBatch.d.ts +13 -13
  240. package/types/resource_loader/SVGLoader.d.ts +7 -6
  241. package/types/resource_loader/TextLoader.d.ts +7 -6
  242. package/types/resource_loader/TextureLoader.d.ts +4 -4
  243. package/types/resource_loader/VideoLoader.d.ts +4 -4
  244. package/types/scenes/AbstractScene.d.ts +32 -32
  245. package/types/scenes/loading_states/CompilatorManager.d.ts +8 -8
  246. package/types/scenes/loading_states/HighQualityLoadingState.d.ts +3 -3
  247. package/types/scenes/loading_states/LoadingState.d.ts +31 -31
  248. package/types/scenes/loading_states/RegularLoadingState.d.ts +5 -5
  249. package/types/static_batcher/BatchedMesh.d.ts +16 -15
  250. package/types/static_batcher/GeometryBatch.d.ts +41 -37
  251. package/types/static_batcher/GeometryBatcher.d.ts +9 -9
  252. package/types/static_batcher/MeshBatcher.d.ts +5 -5
  253. package/types/ui/ui_element_position/ScreenSpacePosition.d.ts +5 -4
  254. package/types/ui/ui_element_position/WorldSpacePosition.d.ts +7 -5
  255. package/types/ui/ui_element_state/OnIdle.d.ts +9 -3
  256. package/types/ui/ui_element_state/OnMouseEnter.d.ts +3 -3
  257. package/types/ui/ui_element_state/OnMouseExit.d.ts +3 -3
  258. package/types/ui/ui_element_state/OnMouseHover.d.ts +8 -4
  259. package/types/ui/ui_element_state/UIElementState.d.ts +17 -5
  260. package/types/utilities/ArrayUtilities.d.ts +7 -7
  261. package/types/utilities/CameraUtilities.d.ts +40 -36
  262. package/types/utilities/EasingFunctions.d.ts +36 -35
  263. package/types/utilities/FrustumPointFitter.d.ts +14 -14
  264. package/types/utilities/GeometryUtilities.d.ts +5 -4
  265. package/types/utilities/HTMLUtilities.d.ts +6 -6
  266. package/types/utilities/ImageUtilities.d.ts +5 -4
  267. package/types/utilities/MeshSampler.d.ts +20 -20
  268. package/types/utilities/ModelUtilities.d.ts +15 -15
  269. package/types/utilities/OMath.d.ts +21 -21
  270. package/types/utilities/ObjectUtilities.d.ts +7 -7
  271. package/types/utilities/OrthographicFrustumPointFitter.d.ts +8 -7
  272. package/types/utilities/PerspectiveFrustumPointFitter.d.ts +14 -12
  273. package/types/utilities/StringUtilities.d.ts +6 -6
  274. package/types/utilities/TimeUtilities.d.ts +3 -3
  275. package/types/utilities/Validation.d.ts +6 -6
  276. package/types/view_components/ApplicationView.d.ts +13 -13
  277. package/types/view_components/TransitionManager.d.ts +20 -20
  278. package/types/view_components/ViewComponent.d.ts +15 -15
  279. package/types/view_components/ViewComponentManager.d.ts +13 -13
  280. package/types/view_components/ViewManager.d.ts +22 -23
  281. package/types/view_components/ViewState.d.ts +14 -14
  282. package/types/view_components/transition/ActionSequencerBuilder.d.ts +16 -16
  283. package/types/view_components/transition/DrawIOAnimationSheet.d.ts +17 -17
  284. package/types/view_components/transition/TransitionTable.d.ts +8 -8
  285. package/types/view_components/transition/ViewStateTransitionHandler.d.ts +19 -19
@@ -1,11 +1,19 @@
1
+ // @ts-check
1
2
  class KeyboardInput
2
3
  {
4
+ /**
5
+ * @param {HTMLElement} container
6
+ */
3
7
  init(container)
4
8
  {
5
9
  this.ctrlz_pressed = false;
6
10
  this.ctrlz_fired = false;
7
11
 
12
+ /**
13
+ * @type {{[key:string]:{key_name: string, pressed: boolean, down: boolean, fired: boolean, released: boolean}}}
14
+ */
8
15
  this.keys = {};
16
+ /** @type {string[]} */
9
17
  this.keys_keys = [];
10
18
  this.container = container;
11
19
 
@@ -13,6 +21,9 @@ class KeyboardInput
13
21
  this.container.addEventListener('keyup', this.on_key_up.bind(this), false);
14
22
  }
15
23
 
24
+ /**
25
+ * @param {KeyboardEvent} e
26
+ */
16
27
  on_key_down(e)
17
28
  {
18
29
  if (e.keyCode === 90 && e.ctrlKey && !this.ctrlz_fired)
@@ -27,6 +38,9 @@ class KeyboardInput
27
38
  }
28
39
  }
29
40
 
41
+ /**
42
+ * @param {KeyboardEvent} e
43
+ */
30
44
  on_key_up(e)
31
45
  {
32
46
  this.release_key(e.code);
@@ -43,6 +57,9 @@ class KeyboardInput
43
57
  }
44
58
  }
45
59
 
60
+ /**
61
+ * @param {string} key_name
62
+ */
46
63
  release_key(key_name)
47
64
  {
48
65
  const key = this.keys[key_name];
@@ -65,6 +82,9 @@ class KeyboardInput
65
82
  }
66
83
  }
67
84
 
85
+ /**
86
+ * @param {string} key_name
87
+ */
68
88
  press_key(key_name)
69
89
  {
70
90
  const key = this.keys[key_name];
@@ -79,6 +99,10 @@ class KeyboardInput
79
99
  }
80
100
  }
81
101
 
102
+ /**
103
+ * @param {string} key_name
104
+ * @returns {boolean}
105
+ */
82
106
  is_key_pressed(key_name)
83
107
  {
84
108
  const key = this.keys[key_name];
@@ -89,6 +113,10 @@ class KeyboardInput
89
113
  return false;
90
114
  }
91
115
 
116
+ /**
117
+ * @param {string} key_name
118
+ * @returns {boolean}
119
+ */
92
120
  is_key_down(key_name)
93
121
  {
94
122
  const key = this.keys[key_name];
@@ -99,6 +127,10 @@ class KeyboardInput
99
127
  return false;
100
128
  }
101
129
 
130
+ /**
131
+ * @param {string} key_name
132
+ * @returns {boolean}
133
+ */
102
134
  is_key_released(key_name)
103
135
  {
104
136
  const key = this.keys[key_name];
@@ -110,6 +142,9 @@ class KeyboardInput
110
142
  return false;
111
143
  }
112
144
 
145
+ /**
146
+ * @param {string} key
147
+ */
113
148
  register_key(key)
114
149
  {
115
150
  this.keys[key] =
@@ -117,12 +152,16 @@ class KeyboardInput
117
152
  key_name: key,
118
153
  pressed: false,
119
154
  down: false,
120
- fired: false
155
+ fired: false,
156
+ released: false
121
157
  };
122
158
 
123
159
  this.keys_keys = Object.keys(this.keys);
124
160
  }
125
161
 
162
+ /**
163
+ * @param {string} key_name
164
+ */
126
165
  unregister_key(key_name)
127
166
  {
128
167
  delete this.keys[key_name];
package/src/OS.js CHANGED
@@ -1,4 +1,4 @@
1
-
1
+ // @ts-check
2
2
  class OS
3
3
  {
4
4
  init()
package/src/OScreen.js CHANGED
@@ -1,22 +1,27 @@
1
+ // @ts-check
1
2
  import { Vector2 } from 'three';
2
3
 
3
4
  class OScreen
4
5
  {
5
6
  init()
6
7
  {
7
- this.width = window.innerWidth;
8
- this.height = window.innerHeight;
8
+ this.width = 1;
9
+ this.height = 1;
9
10
 
10
11
  this.position = new Vector2();
11
12
 
12
- this.render_width = window.innerWidth;
13
- this.render_height = window.innerHeight;
13
+ this.render_width = 1;
14
+ this.render_height = 1;
14
15
  this.width_height = new Vector2(this.width, this.height);
15
16
 
16
17
  this.dpr = 1;
17
18
  this.pixel_size = new Vector2(1 / this.width, 1 / this.height);
18
19
  }
19
20
 
21
+ /**
22
+ * @param {number} x
23
+ * @param {number} y
24
+ */
20
25
  update_position(x, y)
21
26
  {
22
27
  this.position.set(x, y);
@@ -27,6 +32,10 @@ class OScreen
27
32
  this.size_changed = false;
28
33
  }
29
34
 
35
+ /**
36
+ * @param {number} width
37
+ * @param {number} height
38
+ */
30
39
  update_size(width, height)
31
40
  {
32
41
  this.width = width;
@@ -43,6 +52,9 @@ class OScreen
43
52
  this.size_changed = true;
44
53
  }
45
54
 
55
+ /**
56
+ * @param {Vector2} vector2
57
+ */
46
58
  apply_pixel_density_v2(vector2)
47
59
  {
48
60
  vector2.multiplyScalar(1 / this.dpr);
@@ -50,6 +62,9 @@ class OScreen
50
62
  return vector2;
51
63
  }
52
64
 
65
+ /**
66
+ * @param {number} value
67
+ */
53
68
  apply_pixel_density(value)
54
69
  {
55
70
  return value * (1 / this.dpr);
@@ -1,8 +1,17 @@
1
+ // @ts-check
1
2
  import { Color } from 'three';
2
3
  import { OrthographicCamera as TOrthographicCamera } from 'three';
3
4
 
4
5
  class OrthographicCamera extends TOrthographicCamera
5
6
  {
7
+ /**
8
+ * @param {number} left
9
+ * @param {number} right
10
+ * @param {number} top
11
+ * @param {number} bottom
12
+ * @param {number} near
13
+ * @param {number} far
14
+ */
6
15
  constructor(left, right, top, bottom, near, far)
7
16
  {
8
17
  super(left, right, top, bottom, near, far);
@@ -11,6 +20,10 @@ class OrthographicCamera extends TOrthographicCamera
11
20
  this.clear_alpha = 1;
12
21
  }
13
22
 
23
+ /**
24
+ * @param {OrthographicCamera} camera
25
+ * @returns {this}
26
+ */
14
27
  copy(camera)
15
28
  {
16
29
  super.copy(camera);
@@ -1,8 +1,15 @@
1
+ // @ts-check
1
2
  import { Color } from 'three';
2
3
  import { PerspectiveCamera as TPerspectiveCamera } from 'three';
3
4
 
4
5
  class PerspectiveCamera extends TPerspectiveCamera
5
6
  {
7
+ /**
8
+ * @param {number} fov
9
+ * @param {number} aspect
10
+ * @param {number} near
11
+ * @param {number} far
12
+ */
6
13
  constructor(fov, aspect, near, far)
7
14
  {
8
15
  super(fov, aspect, near, far);
@@ -11,6 +18,10 @@ class PerspectiveCamera extends TPerspectiveCamera
11
18
  this.clear_alpha = 1;
12
19
  }
13
20
 
21
+ /**
22
+ * @param {PerspectiveCamera} camera
23
+ * @returns {this}
24
+ */
14
25
  copy(camera)
15
26
  {
16
27
  super.copy(camera);
@@ -1,4 +1,5 @@
1
- import { Vector3 } from 'three';
1
+ // @ts-check
2
+ import { BufferGeometry, Vector3 } from 'three'; // eslint-disable-line
2
3
 
3
4
  class ReflectionPlaneContext
4
5
  {
@@ -8,6 +9,9 @@ class ReflectionPlaneContext
8
9
  this.target_position = new Vector3();
9
10
  }
10
11
 
12
+ /**
13
+ * @param {BufferGeometry} geometry
14
+ */
11
15
  set_target_geometry(geometry)
12
16
  {
13
17
  this.target_geometry = geometry;
@@ -1,4 +1,4 @@
1
-
1
+ // @ts-check
2
2
  class RenderLayers
3
3
  {
4
4
  constructor()
package/src/RenderLoop.js CHANGED
@@ -1,12 +1,18 @@
1
+ // @ts-check
1
2
  import { BaseApplication } from './BaseApplication';
2
3
  import { Debug } from './Debug';
3
4
  import { Time } from './Time';
4
5
  import { TransitionManager } from './view_components/TransitionManager';
5
6
  import { ViewComponentManager } from './view_components/ViewComponentManager';
6
7
  import { ViewManager } from './view_components/ViewManager';
8
+ import { Graphics, KeyboardInput } from './index'; // eslint-disable-line no-unused-vars
7
9
 
8
10
  class RenderLoop
9
11
  {
12
+ /**
13
+ * @param {BaseApplication} target_application
14
+ * @param {Graphics} graphics
15
+ */
10
16
  constructor(target_application, graphics, input)
11
17
  {
12
18
  target_application = target_application || new BaseApplication();
@@ -96,6 +102,9 @@ class RenderLoop
96
102
  this.graphics._renderer.setAnimationLoop(null);
97
103
  }
98
104
 
105
+ /**
106
+ * @param {BaseApplication} new_state
107
+ */
99
108
  set_state(new_state)
100
109
  {
101
110
  this.target_application.on_exit(this);
@@ -1,4 +1,4 @@
1
-
1
+ // @ts-check
2
2
  class RenderOrder
3
3
  {
4
4
  constructor()
@@ -1,11 +1,26 @@
1
+ // @ts-check
2
+ import { Object3D, Texture, } from 'three'; // eslint-disable-line
3
+
4
+ /**
5
+ * @typedef {Object3D | Texture} Resource
6
+ */
7
+
1
8
  class ResourceContainer
2
9
  {
3
10
  init()
4
11
  {
12
+ /** @type {Record<string, Resource>} */
5
13
  this.resources = {};
14
+
15
+ /** @type {Record<string, any>} */
6
16
  this.resources_by_url = {};
7
17
  }
8
18
 
19
+ /**
20
+ * @param {string} name
21
+ * @param {string} url
22
+ * @param {Resource} resource
23
+ */
9
24
  set_resource(name, url, resource)
10
25
  {
11
26
  const urls = Object.keys(this.resources_by_url);
@@ -21,11 +36,17 @@ class ResourceContainer
21
36
  }
22
37
  }
23
38
 
39
+ /**
40
+ * @param {string} name
41
+ */
24
42
  get_resource(name)
25
43
  {
26
44
  return this.resources[name];
27
45
  }
28
46
 
47
+ /**
48
+ * @param {string} name
49
+ */
29
50
  get(name)
30
51
  {
31
52
  return this.resources[name];
@@ -1,4 +1,5 @@
1
- import { Scene } from 'three';
1
+ // @ts-check
2
+ import { Scene, Mesh } from 'three'; // eslint-disable-line no-unused-vars
2
3
 
3
4
  class SceneManager
4
5
  {
@@ -8,11 +9,15 @@ class SceneManager
8
9
  this._current.name = 'default_scene';
9
10
  }
10
11
 
11
- add_scene(name)
12
+ /**
13
+ * @param {string} name
14
+ */
15
+ add_scene(name) // eslint-disable-line no-unused-vars
12
16
  {
13
17
 
14
18
  }
15
19
 
20
+ /** @type {Scene} */
16
21
  get current()
17
22
  {
18
23
  return this._current;
@@ -25,12 +30,17 @@ class SceneManager
25
30
 
26
31
  dispose()
27
32
  {
28
- this.current.traverse(child =>
33
+ this.current.traverse((/** @type {Mesh} */ child) =>
29
34
  {
30
35
  if (child.geometry)
31
36
  {
32
37
  child.geometry.dispose();
33
- child.material.dispose();
38
+ const mat = child.material;
39
+ if ('disppose' in mat && typeof (mat.disppose) === 'function')
40
+ {
41
+ // @ts-ignore
42
+ mat.dispose();
43
+ }
34
44
  }
35
45
  });
36
46
 
package/src/Screen.js ADDED
@@ -0,0 +1,71 @@
1
+ // @ts-check
2
+ import { Vector2 } from 'three'; // eslint-disable-line
3
+ import { OScreen } from './OScreen';
4
+
5
+ class Screen
6
+ {
7
+ init()
8
+ {
9
+ console.warn('Screen Singleton is deprecated. Please use OScreen.');
10
+ OScreen.init();
11
+ }
12
+
13
+ /**
14
+ * @param {number} x
15
+ * @param {number} y
16
+ */
17
+ update_position(x, y)
18
+ {
19
+ console.warn('Screen Singleton is deprecated. Please use OScreen.');
20
+ OScreen.update_position(x, y);
21
+ }
22
+
23
+ update()
24
+ {
25
+ console.warn('Screen Singleton is deprecated. Please use OScreen.');
26
+ OScreen.update();
27
+ }
28
+
29
+ /**
30
+ * @param {number} width
31
+ * @param {number} height
32
+ */
33
+ update_size(width, height)
34
+ {
35
+ console.warn('Screen Singleton is deprecated. Please use OScreen.');
36
+ OScreen.update_size(width, height);
37
+ }
38
+
39
+ /**
40
+ * @param {Vector2} vector2
41
+ */
42
+ apply_pixel_density_v2(vector2)
43
+ {
44
+ console.warn('Screen Singleton is deprecated. Please use OScreen.');
45
+ return OScreen.apply_pixel_density_v2(vector2);
46
+ }
47
+
48
+ /**
49
+ * @param {number} value
50
+ */
51
+ apply_pixel_density(value)
52
+ {
53
+ console.warn('Screen Singleton is deprecated. Please use OScreen.');
54
+ return OScreen.apply_pixel_density(value);
55
+ }
56
+
57
+ get_pixel_size()
58
+ {
59
+ console.warn('Screen Singleton is deprecated. Please use OScreen.');
60
+ return OScreen.get_pixel_size();
61
+ }
62
+
63
+ get aspect_ratio()
64
+ {
65
+ console.warn('Screen Singleton is deprecated. Please use OScreen.');
66
+ return OScreen.aspect_ratio;
67
+ }
68
+ }
69
+
70
+ const screen = new Screen();
71
+ export { screen as Screen };
package/src/Time.js CHANGED
@@ -1,3 +1,4 @@
1
+ // @ts-check
1
2
  import { Vector2 } from 'three';
2
3
  import { Clock } from 'three';
3
4
 
@@ -61,6 +62,9 @@ class Time
61
62
  return this.smooth_delta_time;
62
63
  }
63
64
 
65
+ /**
66
+ * @param {number} value
67
+ */
64
68
  __set_frame_interpolation(value)
65
69
  {
66
70
  this.__frame_interpolation_t = value;
package/src/UI.js CHANGED
@@ -1,15 +1,18 @@
1
+ // @ts-check
1
2
  import { CameraManager } from './CameraManager';
2
3
  import { Graphics } from './Graphics';
3
4
 
4
5
  import { Vector2 } from 'three';
5
6
  import { Scene } from 'three';
6
- import { OrthographicCamera } from 'three';
7
+ import { OrthographicCamera } from './OrthographicCamera';
8
+ import { UIElement } from './components/UIElement'; // eslint-disable-line
7
9
 
8
10
  class UI
9
11
  {
10
12
  init(input)
11
13
  {
12
14
  this.input = input;
15
+ /** @type {UIElement[]} */
13
16
  this.ui_elements = [];
14
17
  this._tmp_normalized_pos = new Vector2();
15
18
  this.ss_scene = new Scene();
@@ -23,6 +26,9 @@ class UI
23
26
  this.ss_camera = new OrthographicCamera(-1, 1, 1, -1, -100, 100);
24
27
  }
25
28
 
29
+ /**
30
+ * @param {UIElement} elem
31
+ */
26
32
  delete_element(elem)
27
33
  {
28
34
  const index = this.ui_elements.indexOf(elem);
@@ -37,6 +43,9 @@ class UI
37
43
  elem.dispose();
38
44
  }
39
45
 
46
+ /**
47
+ * @param {UIElement} elem
48
+ */
40
49
  add_screen_space_element(elem)
41
50
  {
42
51
  this.ui_elements.push(elem);
@@ -45,6 +54,9 @@ class UI
45
54
  elem.set_screen_space_coordinate_system();
46
55
  }
47
56
 
57
+ /**
58
+ * @param {UIElement} elem
59
+ */
48
60
  add_world_space_element(elem)
49
61
  {
50
62
  this.ui_elements.push(elem);
@@ -68,6 +80,9 @@ class UI
68
80
  }
69
81
  }
70
82
 
83
+ /**
84
+ * @param {Graphics} renderer
85
+ */
71
86
  render(renderer)
72
87
  {
73
88
  // renderer.render_ui(this.scene);
@@ -1,6 +1,11 @@
1
-
1
+ // @ts-check
2
2
  class ActionEvent
3
3
  {
4
+ /**
5
+ * @param {string} name
6
+ * @param {string} method
7
+ * @param {string} args
8
+ */
4
9
  constructor(name, method, args)
5
10
  {
6
11
  this.name = name;
@@ -1,7 +1,12 @@
1
+ // @ts-check
2
+ import { Vector3 } from 'three'; // eslint-disable-line no-unused-vars
1
3
  import { EasingFunctions } from '../utilities/EasingFunctions';
2
4
 
3
5
  class ActionInterpolator
4
6
  {
7
+ /**
8
+ * @param {import('../utilities/EasingFunctions').EasingFunctionType | function} easing_function
9
+ */
5
10
  constructor(easing_function = 'linear')
6
11
  {
7
12
  this.easing_function = undefined;
@@ -14,11 +19,20 @@ class ActionInterpolator
14
19
  {
15
20
  this.easing_function = easing_function;
16
21
  }
22
+
23
+ this.attribute_name = '';
24
+ /** @type {number | Vector3} */
25
+ this.from = 0;
26
+ /** @type {number | Vector3} */
27
+ this.to = 1;
17
28
  }
18
29
 
19
- update(context, t)
30
+ /**
31
+ * @param {any} context
32
+ * @param {number} t
33
+ */
34
+ update(context, t) // eslint-disable-line no-unused-vars
20
35
  {
21
-
22
36
  }
23
37
  }
24
38