ohzi-core 10.6.7 → 11.0.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 (71) hide show
  1. package/build/index.module.js +1 -1
  2. package/build/index.module.js.map +1 -1
  3. package/package.json +9 -11
  4. package/src/BaseApplication.js +3 -0
  5. package/src/Browser.js +4 -4
  6. package/src/Graphics.js +17 -19
  7. package/src/Initializer.js +1 -7
  8. package/src/OS.js +2 -2
  9. package/src/RenderLoop.js +16 -13
  10. package/src/action_sequencer/ActionEvent.js +1 -2
  11. package/src/action_sequencer/ActionSequencer.js +3 -7
  12. package/src/data_textures/RGBDataTexture.js +2 -2
  13. package/src/data_textures/RGBFloatDataTexture.js +2 -3
  14. package/src/gpu_particles/ParticleAttribute.js +2 -7
  15. package/src/index.js +41 -141
  16. package/src/materials/SSAOMaterial.js +2 -6
  17. package/src/primitives/Arrow.js +3 -6
  18. package/src/primitives/Sphere.js +2 -4
  19. package/src/render_mode/DeferredRender.js +5 -9
  20. package/src/render_mode/NormalAORender.js +7 -8
  21. package/src/resource_loader/AsyncTextureLoader.js +5 -3
  22. package/src/resource_loader/BasisLoader.js +0 -4
  23. package/src/static_batcher/GeometryBatch.js +2 -8
  24. package/src/view_components/ApplicationView.js +2 -29
  25. package/src/view_components/ApplicationViewController.js +95 -0
  26. package/src/view_components/TransitionManager.js +60 -0
  27. package/src/view_components/VCManager.js +9 -0
  28. package/src/view_components/ViewComponent.js +9 -36
  29. package/src/view_components/ViewComponentController.js +73 -0
  30. package/src/view_components/ViewComponentControllerManager.js +59 -0
  31. package/src/view_components/ViewComponentManager.js +3 -13
  32. package/src/view_components/ViewControllerManager.js +91 -0
  33. package/src/view_components/ViewManager.js +11 -104
  34. package/src/view_components/ViewState.js +0 -7
  35. package/src/view_components/WorkerToMain.js +25 -0
  36. package/src/view_components/transition/ActionSequencerBuilder.js +3 -3
  37. package/src/view_components/transition/TransitionTable.js +9 -2
  38. package/types/BaseApplication.d.ts +1 -0
  39. package/types/Browser.d.ts +1 -1
  40. package/types/CameraManager.d.ts +2 -4
  41. package/types/Graphics.d.ts +8 -3
  42. package/types/Initializer.d.ts +1 -1
  43. package/types/RenderLoop.d.ts +1 -2
  44. package/types/SceneManager.d.ts +1 -3
  45. package/types/action_sequencer/ActionSequencer.d.ts +2 -2
  46. package/types/blitter_index.d.ts +6 -0
  47. package/types/index.d.ts +75 -73
  48. package/types/render_mode/NormalAORender.d.ts +1 -0
  49. package/types/resource_loader/AsyncTextureLoader.d.ts +1 -0
  50. package/types/utilities/FrustumPointFitter.d.ts +1 -3
  51. package/types/utilities/OMath.d.ts +9 -9
  52. package/types/view_components/ApplicationView.d.ts +1 -3
  53. package/types/view_components/ApplicationViewController.d.ts +11 -0
  54. package/types/view_components/TransitionManager.d.ts +17 -0
  55. package/types/view_components/VCManager.d.ts +5 -0
  56. package/types/view_components/ViewComponent.d.ts +1 -5
  57. package/types/view_components/ViewComponentController.d.ts +14 -0
  58. package/types/view_components/ViewComponentControllerManager.d.ts +12 -0
  59. package/types/view_components/ViewComponentManager.d.ts +0 -1
  60. package/types/view_components/ViewControllerManager.d.ts +12 -0
  61. package/types/view_components/ViewManager.d.ts +4 -22
  62. package/types/view_components/ViewState.d.ts +0 -1
  63. package/types/view_components/WorkerToMain.d.ts +8 -0
  64. package/types/view_components/transition/ActionSequencerBuilder.d.ts +1 -1
  65. package/types/view_components/transition/TransitionTable.d.ts +2 -0
  66. package/src/Configuration.js +0 -23
  67. package/src/Screen.js +0 -55
  68. package/src/render_mode/TransparencyMixRender.js +0 -147
  69. package/src/view_components/ViewContext.js +0 -15
  70. package/types/Configuration.d.ts +0 -8
  71. package/types/view_components/ViewContext.d.ts +0 -6
@@ -0,0 +1,91 @@
1
+ import { TransitionManager } from './TransitionManager';
2
+
3
+ class ViewControllerManager
4
+ {
5
+ constructor()
6
+ {
7
+ this.view_controllers = [];
8
+ }
9
+
10
+ go_to_view_controller(view_controller_name, skip = false)
11
+ {
12
+ const v = this.get(view_controller_name);
13
+ TransitionManager.transition_handler.go_to_state(v, skip);
14
+ }
15
+
16
+ update()
17
+ {
18
+ this.__set_view_controllers_opacities();
19
+ }
20
+
21
+ register_view_controller(view_controller)
22
+ {
23
+ this.view_controllers.push(view_controller);
24
+ }
25
+
26
+ set_view_controller(view_controller_name)
27
+ {
28
+ const view_controller = this.get(view_controller_name);
29
+
30
+ TransitionManager.transition_handler.set_state(view_controller);
31
+ }
32
+
33
+ get_current_view_controller()
34
+ {
35
+ return TransitionManager.transition_handler.current_state;
36
+ }
37
+
38
+ get(view_controller_name)
39
+ {
40
+ for (let i = 0; i < this.view_controllers.length; i++)
41
+ {
42
+ if (this.view_controllers[i].name === view_controller_name)
43
+ {
44
+ return this.view_controllers[i];
45
+ }
46
+ }
47
+ console.error('[ViewControllerManager.get] no view controller found for: ', view_controller_name);
48
+ return undefined;
49
+ }
50
+
51
+ // get_by_url(url)
52
+ // {
53
+ // for (let i = 0; i < this.view_controllers.length; i++)
54
+ // {
55
+ // if (this.view_controllers[i].url === url)
56
+ // {
57
+ // return this.view_controllers[i];
58
+ // }
59
+ // }
60
+ // console.error('[ViewControllerManager.get_by_url] no view controller found for: ', url);
61
+ // return undefined;
62
+ // }
63
+
64
+ __set_view_controllers_opacities()
65
+ {
66
+ for (let i = 0; i < this.view_controllers.length; i++)
67
+ {
68
+ this.view_controllers[i].set_opacity(TransitionManager.transition_handler.current_state_data);
69
+ }
70
+ }
71
+
72
+ __capitalize(string)
73
+ {
74
+ let aux_string = string.toUpperCase().replace('/', '');
75
+ aux_string = this.__snake_to_whitespace(aux_string);
76
+
77
+ return aux_string;
78
+ }
79
+
80
+ __snake_to_whitespace(string)
81
+ {
82
+ return string.replace(
83
+ /([-_][A-Z])/g,
84
+ (group) => group
85
+ .replace('-', ' ')
86
+ .replace('_', ' ')
87
+ );
88
+ }
89
+ }
90
+
91
+ export { ViewControllerManager };
@@ -1,41 +1,17 @@
1
- import { TransitionTable } from './transition/TransitionTable';
2
- import { ViewStateTransitionHandler } from './transition/ViewStateTransitionHandler';
3
1
 
4
2
  class ViewManager
5
3
  {
6
4
  constructor()
7
5
  {
8
6
  this.views = [];
9
-
10
- this.transition_table = new TransitionTable();
11
- this.transition_handler = new ViewStateTransitionHandler(this.transition_table);
12
-
13
- this.view_change_subscribers = [];
7
+ this.main_to_worker = undefined;
14
8
 
15
9
  this.browser_title_suffix = '';
16
10
  }
17
11
 
18
- before_update()
19
- {
20
- this.transition_handler.before_update();
21
- }
22
-
23
- update()
24
- {
25
- this.transition_handler.update();
26
-
27
- this.__set_views_opacities();
28
- }
29
-
30
- fixed_update()
31
- {
32
- this.transition_handler.fixed_update();
33
- }
34
-
35
12
  go_to_view(view_name, change_url = true, skip = false)
36
13
  {
37
14
  const v = this.get(view_name);
38
- this.transition_handler.go_to_state(v, skip);
39
15
 
40
16
  if (change_url)
41
17
  {
@@ -43,64 +19,16 @@ class ViewManager
43
19
  this.__change_browser_title(v.url);
44
20
  }
45
21
 
46
- this.notify_view_change(view_name);
22
+ this.main_to_worker.post('go_to_view_controller', { view_controller_name: view_name, skip });
47
23
  }
48
24
 
49
25
  go_to_scene(scene_name, change_url = false, skip = false)
50
26
  {
51
- const next_view = this.get(scene_name);
52
27
  const transition_view = this.get('transition');
53
28
 
54
- transition_view.set_next_view(next_view);
55
- this.go_to_view(transition_view.name, change_url, skip);
56
- }
57
-
58
- subscribe_to_view_change(subscriber)
59
- {
60
- this.view_change_subscribers.push(subscriber);
61
- }
29
+ transition_view.set_next_view_name(scene_name);
62
30
 
63
- notify_view_change(view_name)
64
- {
65
- for (let i = 0; i < this.view_change_subscribers.length; i++)
66
- {
67
- const subscriber = this.view_change_subscribers[i];
68
- subscriber.on_view_change(view_name);
69
- }
70
- }
71
-
72
- register_view(view)
73
- {
74
- this.views.push(view);
75
- }
76
-
77
- has_view(view_name)
78
- {
79
- for (let i = 0; i < this.views.length; i++)
80
- {
81
- if (this.views[i].name === view_name)
82
- {
83
- return true;
84
- }
85
- }
86
- return false;
87
- }
88
-
89
- add_transitions(transitions)
90
- {
91
- this.transition_table.add_transitions(transitions);
92
- }
93
-
94
- set_transitions(transitions)
95
- {
96
- this.transition_table.set_transitions(transitions);
97
- }
98
-
99
- set_view(view_name)
100
- {
101
- const view = this.get(view_name);
102
-
103
- this.transition_handler.set_state(view);
31
+ this.go_to_view(transition_view.name, change_url, skip);
104
32
  }
105
33
 
106
34
  set_browser_title_suffix(title_suffix)
@@ -108,17 +36,6 @@ class ViewManager
108
36
  this.browser_title_suffix = title_suffix;
109
37
  }
110
38
 
111
- get_current_view()
112
- {
113
- return this.transition_handler.current_state;
114
- }
115
-
116
- get_view_by_name(view_name)
117
- {
118
- console.warn('DEPRECATED. Use ViewManager.get instead');
119
- this.get(view_name);
120
- }
121
-
122
39
  get(view_name)
123
40
  {
124
41
  for (let i = 0; i < this.views.length; i++)
@@ -132,12 +49,6 @@ class ViewManager
132
49
  return undefined;
133
50
  }
134
51
 
135
- get_view_by_url(url)
136
- {
137
- console.warn('DEPRECATED. Use ViewManager.get_by_url instead');
138
- this.get_by_url(url);
139
- }
140
-
141
52
  get_by_url(url)
142
53
  {
143
54
  for (let i = 0; i < this.views.length; i++)
@@ -151,10 +62,14 @@ class ViewManager
151
62
  return undefined;
152
63
  }
153
64
 
154
- set_default_state_data(default_state_data)
65
+ register_view(view)
66
+ {
67
+ this.views.push(view);
68
+ }
69
+
70
+ set_main_to_worker(main_to_worker)
155
71
  {
156
- this.transition_table.set_default_state_data(default_state_data);
157
- this.transition_handler.set_default_state_data(default_state_data);
72
+ this.main_to_worker = main_to_worker;
158
73
  }
159
74
 
160
75
  __change_browser_url(url)
@@ -169,14 +84,6 @@ class ViewManager
169
84
  document.title = title ? `${title} | ${this.browser_title_suffix}` : this.browser_title_suffix;
170
85
  }
171
86
 
172
- __set_views_opacities()
173
- {
174
- for (let i = 0; i < this.views.length; i++)
175
- {
176
- this.views[i].set_opacity(this.transition_handler.current_state_data);
177
- }
178
- }
179
-
180
87
  __capitalize(string)
181
88
  {
182
89
  let aux_string = string.toUpperCase().replace('/', '');
@@ -39,19 +39,12 @@ class ViewState
39
39
 
40
40
  update_enter_transition(global_view_data, transition_progress, action_sequencer)
41
41
  {
42
- // Backward compatibility. It will be removed in future releases.
43
- this.update_transition(global_view_data, transition_progress, action_sequencer);
44
42
  }
45
43
 
46
44
  update_exit_transition(global_view_data, transition_progress, action_sequencer)
47
45
  {
48
46
  }
49
47
 
50
- // Deprecated
51
- update_transition(global_view_data, transition_progress, action_sequencer)
52
- {
53
- }
54
-
55
48
  before_exit()
56
49
  {
57
50
  }
@@ -0,0 +1,25 @@
1
+
2
+ class WorkerToMain
3
+ {
4
+ constructor()
5
+ {
6
+ // TODO: Use SharedArrayBuffer?
7
+ this.methods = [];
8
+ this.args = [];
9
+ }
10
+
11
+ push(method, args = [])
12
+ {
13
+ this.methods.push(method);
14
+ this.args.push(args);
15
+ }
16
+
17
+ clear()
18
+ {
19
+ this.methods = [];
20
+ this.args = [];
21
+ }
22
+ }
23
+
24
+ const worker_to_main = new WorkerToMain();
25
+ export { worker_to_main as WorkerToMain };
@@ -1,6 +1,6 @@
1
+ import { ActionEvent } from '../../action_sequencer/ActionEvent';
1
2
  import { ActionSequencer } from '../../action_sequencer/ActionSequencer';
2
3
  import { NumberInterpolator } from '../../action_sequencer/NumberInterpolator';
3
- import { ActionEvent } from '../../action_sequencer/ActionEvent';
4
4
  import { DrawIOAnimationSheet } from './DrawIOAnimationSheet';
5
5
 
6
6
  class ActionSequencerBuilder
@@ -10,7 +10,7 @@ class ActionSequencerBuilder
10
10
  this.default_state_data = default_state_data;
11
11
  }
12
12
 
13
- from_animation_sheet(animation_data, current_context, initial_context)
13
+ from_animation_sheet(animation_data, current_context, initial_context, transitions_velocity)
14
14
  {
15
15
  initial_context = initial_context || this.default_state_data;
16
16
  const tracks = animation_data.animation_tracks;
@@ -26,7 +26,7 @@ class ActionSequencerBuilder
26
26
  }
27
27
  }
28
28
 
29
- const sequencer = new ActionSequencer(current_context);
29
+ const sequencer = new ActionSequencer(current_context, transitions_velocity);
30
30
 
31
31
  for (let i = 0; i < tracks.length; i++)
32
32
  {
@@ -6,6 +6,8 @@ class TransitionTable
6
6
  {
7
7
  this.transitions = [];
8
8
  this.default_state_data = {};
9
+
10
+ this.transitions_velocity = 1;
9
11
  }
10
12
 
11
13
  get(from_state_name, to_state_name, current_context)
@@ -14,7 +16,7 @@ class TransitionTable
14
16
  {
15
17
  if (this.transitions[i].from === from_state_name && this.transitions[i].to === to_state_name)
16
18
  {
17
- const action_sequencer = new ActionSequencerBuilder(this.default_state_data).from_animation_sheet(this.transitions[i].data, current_context);
19
+ const action_sequencer = new ActionSequencerBuilder(this.default_state_data).from_animation_sheet(this.transitions[i].data, current_context, this.transitions_velocity);
18
20
  return action_sequencer;
19
21
  }
20
22
  }
@@ -23,7 +25,7 @@ class TransitionTable
23
25
  {
24
26
  if (this.transitions[i].to === to_state_name && this.transitions[i].from === undefined)
25
27
  {
26
- const action_sequencer = new ActionSequencerBuilder(this.default_state_data).from_animation_sheet(this.transitions[i].data, current_context);
28
+ const action_sequencer = new ActionSequencerBuilder(this.default_state_data).from_animation_sheet(this.transitions[i].data, current_context, this.transitions_velocity);
27
29
  return action_sequencer;
28
30
  }
29
31
  }
@@ -49,6 +51,11 @@ class TransitionTable
49
51
  {
50
52
  this.default_state_data = default_state_data;
51
53
  }
54
+
55
+ set_transitions_velocity(transitions_velocity)
56
+ {
57
+ this.transitions_velocity = transitions_velocity;
58
+ }
52
59
  }
53
60
 
54
61
  export { TransitionTable };
@@ -8,4 +8,5 @@ export class BaseApplication {
8
8
  on_post_render(): void;
9
9
  on_pre_render(): void;
10
10
  on_frame_end(): void;
11
+ dispose(): void;
11
12
  }
@@ -1,7 +1,7 @@
1
1
  export { browser as Browser };
2
2
  declare const browser: Browser;
3
3
  declare class Browser {
4
- init(): void;
4
+ init(opr: any, chrome: any): void;
5
5
  browser_name: string;
6
6
  agent: string;
7
7
  vr_browser_keywords: string[];
@@ -1,11 +1,9 @@
1
- import { Camera } from "three";
2
-
3
1
  export { camera_manager as CameraManager };
4
2
  declare const camera_manager: CameraManager;
5
3
  declare class CameraManager {
6
4
  init(): void;
7
- _current: Camera;
8
- _spectator: Camera;
5
+ _current: any;
6
+ _spectator: any;
9
7
  set current(arg: any);
10
8
  get current(): any;
11
9
  set spectator(arg: any);
@@ -1,7 +1,13 @@
1
1
  export { graphics as Graphics };
2
2
  declare const graphics: Graphics;
3
3
  declare class Graphics {
4
- init(canvas: any, core_attributes: any, context_attributes: any, threejs_attributes: any): void;
4
+ init({ canvas, core_attributes, context_attributes, threejs_attributes, dpr }: {
5
+ canvas: any;
6
+ core_attributes: any;
7
+ context_attributes: any;
8
+ threejs_attributes: any;
9
+ dpr: any;
10
+ }): void;
5
11
  _renderer: any;
6
12
  blitter: Blitter;
7
13
  canvas: any;
@@ -29,7 +35,6 @@ declare class Graphics {
29
35
  threejs_attributes: {
30
36
  logarithmicDepthBuffer: boolean;
31
37
  };
32
- resize_observer: ResizeObserver;
33
38
  get dom_element(): any;
34
39
  get depth_normals_RT(): any;
35
40
  set_state(new_state: any): void;
@@ -40,7 +45,7 @@ declare class Graphics {
40
45
  __apply_override_material(scene: any, mat: any): void;
41
46
  readback_RT(RT: any, buffer: any): void;
42
47
  clear(RT: any, camera: any, clear_depth: any, clear_stencil: any): void;
43
- on_resize(entries: any): void;
48
+ on_resize(entries: any, dpr: any): void;
44
49
  material_pass(mat: any, dst: any): void;
45
50
  blit(src_RT: any, dst_RT: any, mat: any): void;
46
51
  blit_clear_with_material(dst_RT: any, mat: any): void;
@@ -2,5 +2,5 @@ export { initializer as Initializer };
2
2
  declare const initializer: Initializer;
3
3
  declare class Initializer {
4
4
  init(input: any): void;
5
- dispose(render_loop: any): void;
5
+ dispose(): void;
6
6
  }
@@ -1,8 +1,7 @@
1
1
  export class RenderLoop {
2
- constructor(target_application: any, graphics: any, input: any);
2
+ constructor(target_application: any, graphics: any);
3
3
  target_application: any;
4
4
  graphics: any;
5
- input: any;
6
5
  is_running: boolean;
7
6
  frames_passed: number;
8
7
  time_accumulator: number;
@@ -2,11 +2,9 @@ export { scene_manager as SceneManager };
2
2
  declare const scene_manager: SceneManager;
3
3
  declare class SceneManager {
4
4
  init(): void;
5
- _current: Scene;
5
+ _current: any;
6
6
  add_scene(name: any): void;
7
7
  set current(arg: any);
8
8
  get current(): any;
9
9
  dispose(): void;
10
10
  }
11
-
12
- import { Scene } from "three";
@@ -1,5 +1,5 @@
1
1
  export class ActionSequencer {
2
- constructor(context?: {});
2
+ constructor(context: {}, transitions_velocity: any);
3
3
  previous_elapsed_time: number;
4
4
  elapsed_time: number;
5
5
  playback_speed: number;
@@ -32,5 +32,5 @@ export class ActionSequencer {
32
32
  is_channel_redefined(channel_name: any): boolean;
33
33
  __linear_map_01(value: any, from_range_start_value: any, from_range_end_value: any): number;
34
34
  __get_current_keyframe(channel_name: any, time: any): any;
35
- __get_playback_speed(): number;
35
+ __get_playback_speed(transitions_velocity: any): number;
36
36
  }
@@ -0,0 +1,6 @@
1
+ import { MedianFilter } from "./render_utilities/MedianFilter";
2
+ import { GaussianBlurrer } from "./render_utilities/GaussianBlurrer";
3
+ import { Blurrer } from "./render_utilities/Blurrer";
4
+ import { Blitter } from "./render_utilities/Blitter";
5
+ import { DualFilteringBlurMaterial } from "./materials/DualFilteringBlurMaterial";
6
+ export { MedianFilter, GaussianBlurrer, Blurrer, Blitter, DualFilteringBlurMaterial };