ohzi-core 10.6.0 → 10.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ohzi-core",
3
- "version": "10.6.0",
3
+ "version": "10.6.2",
4
4
  "description": "OHZI Core Library",
5
5
  "source": "src/index.js",
6
6
  "module": "build/index.module.js",
@@ -9,6 +9,9 @@ class BaseApplication
9
9
  on_exit()
10
10
  {}
11
11
 
12
+ before_update()
13
+ {}
14
+
12
15
  update()
13
16
  {}
14
17
 
package/src/Browser.js CHANGED
@@ -7,13 +7,16 @@ class Browser
7
7
  this.agent = window.navigator.userAgent.toLowerCase();
8
8
 
9
9
  // vr specific
10
- this.vrBrowserKeywords = ['OculusBrowser', 'oculus', 'vive', 'rift', 'windowsmr', 'cardboard', 'daydream'];
11
- this.vrBrowser = this.vrBrowserKeywords.find(keyword => this.agent.includes(keyword));
10
+ this.vr_browser_keywords = ['oculusbrowser', 'oculus', 'vive', 'rift', 'windowsmr', 'cardboard', 'daydream'];
11
+ this.vr_browser_name = this.vr_browser_keywords.find(keyword => this.agent.includes(keyword));
12
12
  // Check for WebXR support (indicating VR capabilities)
13
- this.hasWebXRSupport = 'xr' in navigator;
13
+ this.has_web_xr_support = 'xr' in navigator;
14
14
 
15
15
  switch (true)
16
16
  {
17
+ case this.vr_browser_name !== undefined && this.has_web_xr_support:
18
+ this.browser_name = this.vr_browser_name;
19
+ break;
17
20
  case this.agent.indexOf('edge') > -1:
18
21
  this.browser_name = 'edge_ie';
19
22
  break;
@@ -35,9 +38,6 @@ class Browser
35
38
  case this.agent.indexOf('safari') > -1:
36
39
  this.browser_name = 'safari';
37
40
  break;
38
- case this.vrBrowser && this.hasWebXRSupport:
39
- this.browser_name = this.vrBrowser;
40
- break;
41
41
  default:
42
42
  this.browser_name = 'other';
43
43
  break;
@@ -73,7 +73,7 @@ class Browser
73
73
 
74
74
  get is_vr()
75
75
  {
76
- return this.vrBrowserKeywords.includes(this.browser_name);
76
+ return this.vr_browser_keywords.includes(this.browser_name);
77
77
  }
78
78
 
79
79
  get has_webm()
package/src/RenderLoop.js CHANGED
@@ -39,9 +39,13 @@ class RenderLoop
39
39
 
40
40
  this.time_accumulator += Time.delta_time;
41
41
 
42
+ this.target_application.before_update();
43
+ ViewManager.before_update();
44
+
42
45
  while (this.time_accumulator > Time.fixed_delta_time)
43
46
  {
44
47
  this.target_application.fixed_update();
48
+ ViewManager.fixed_update();
45
49
  this.time_accumulator -= Time.fixed_delta_time;
46
50
  }
47
51
  Time.__set_frame_interpolation(this.time_accumulator / Time.fixed_delta_time);
@@ -15,6 +15,11 @@ class ViewManager
15
15
  this.browser_title_suffix = '';
16
16
  }
17
17
 
18
+ before_update()
19
+ {
20
+ this.transition_handler.before_update();
21
+ }
22
+
18
23
  update()
19
24
  {
20
25
  this.transition_handler.update();
@@ -22,6 +27,11 @@ class ViewManager
22
27
  this.__set_views_opacities();
23
28
  }
24
29
 
30
+ fixed_update()
31
+ {
32
+ this.transition_handler.fixed_update();
33
+ }
34
+
25
35
  go_to_view(view_name, change_url = true, skip = false)
26
36
  {
27
37
  const v = this.get(view_name);
@@ -25,10 +25,18 @@ class ViewState
25
25
  {
26
26
  }
27
27
 
28
+ before_update()
29
+ {
30
+ }
31
+
28
32
  update()
29
33
  {
30
34
  }
31
35
 
36
+ fixed_update()
37
+ {
38
+ }
39
+
32
40
  update_enter_transition(global_view_data, transition_progress, action_sequencer)
33
41
  {
34
42
  // Backward compatibility. It will be removed in future releases.
@@ -66,6 +66,16 @@ class ViewStateTransitionHandler
66
66
  }
67
67
  }
68
68
 
69
+ before_update()
70
+ {
71
+ this.current_state.before_update();
72
+ }
73
+
74
+ fixed_update()
75
+ {
76
+ this.current_state.fixed_update();
77
+ }
78
+
69
79
  set_state(state)
70
80
  {
71
81
  this.current_state = state;
@@ -2,7 +2,9 @@ export class BaseApplication {
2
2
  on_post_start(): void;
3
3
  on_enter(): void;
4
4
  on_exit(): void;
5
+ before_update(): void;
5
6
  update(): void;
7
+ fixed_update(): void;
6
8
  on_post_render(): void;
7
9
  on_pre_render(): void;
8
10
  on_frame_end(): void;
@@ -4,12 +4,16 @@ declare class Browser {
4
4
  init(): void;
5
5
  browser_name: string;
6
6
  agent: string;
7
+ vr_browser_keywords: string[];
8
+ vr_browser_name: string;
9
+ has_web_xr_support: boolean;
7
10
  version: number;
8
11
  get name(): string;
9
12
  get is_safari(): boolean;
10
13
  get is_chrome(): boolean;
11
14
  get is_edge(): boolean;
12
15
  get is_edge_chromium(): boolean;
16
+ get is_vr(): boolean;
13
17
  get has_webm(): boolean;
14
18
  get has_hvec(): boolean;
15
19
  get preferred_video_extension(): "webm" | "hvec.mp4" | "mp4";
@@ -1,7 +1,7 @@
1
1
  export { graphics as Graphics };
2
2
  declare const graphics: Graphics;
3
3
  declare class Graphics {
4
- init(canvas: any, context_attributes: any): void;
4
+ init(canvas: any, core_attributes: any, context_attributes: any, threejs_attributes: any): void;
5
5
  _renderer: any;
6
6
  blitter: Blitter;
7
7
  canvas: any;
@@ -13,17 +13,22 @@ declare class Graphics {
13
13
  canvas_context: any;
14
14
  context_attributes: {
15
15
  alpha: boolean;
16
+ antialias: boolean;
16
17
  depth: boolean;
17
18
  desynchronized: boolean;
18
- stencil: boolean;
19
- antialias: boolean;
19
+ failIfMajorPerformanceCaveat: boolean;
20
+ powerPreference: string;
20
21
  premultipliedAlpha: boolean;
21
22
  preserveDrawingBuffer: boolean;
22
- powerPreference: string;
23
- logarithmicDepthBuffer: boolean;
23
+ stencil: boolean;
24
+ };
25
+ core_attributes: {
24
26
  force_webgl2: boolean;
25
27
  xr_enabled: boolean;
26
28
  };
29
+ threejs_attributes: {
30
+ logarithmicDepthBuffer: boolean;
31
+ };
27
32
  resize_observer: ResizeObserver;
28
33
  get dom_element(): any;
29
34
  get depth_normals_RT(): any;
@@ -3,7 +3,7 @@ export class KeyboardInput {
3
3
  ctrlz_pressed: boolean;
4
4
  ctrlz_fired: boolean;
5
5
  keys: {};
6
- keys_keys: any[];
6
+ keys_keys: any[] | string[];
7
7
  container: any;
8
8
  on_key_down(e: any): void;
9
9
  on_key_up(e: any): void;
@@ -5,6 +5,7 @@ export class RenderLoop {
5
5
  input: any;
6
6
  is_running: boolean;
7
7
  frames_passed: number;
8
+ time_accumulator: number;
8
9
  update(): void;
9
10
  start(): void;
10
11
  stop(): void;
package/types/Time.d.ts CHANGED
@@ -1,15 +1,24 @@
1
1
  export { time as Time };
2
2
  declare const time: Time;
3
3
  declare class Time {
4
- delta_buffer: number[];
4
+ __delta_buffer: number[];
5
5
  init(): void;
6
6
  ___time: any;
7
- __raw_delta_time: any;
7
+ __delta_time: any;
8
+ __smooth_delta_time: any;
8
9
  __elapsed_time: any;
9
10
  __allocated_time: any;
10
- delta_time: any;
11
+ __frame_interpolation_t: any;
12
+ fixed_delta_time: number;
11
13
  get elapsed_time(): any;
14
+ get delta_time(): any;
15
+ get smooth_delta_time(): any;
12
16
  get shader_time(): any;
17
+ get frame_interpolation(): any;
18
+ get fdt(): number;
19
+ get dt(): any;
20
+ get sdt(): any;
21
+ __set_frame_interpolation(value: any): void;
13
22
  __update(): void;
14
- __calculate_delta_time(): void;
23
+ __calculate_smooth_delta_time(): void;
15
24
  }
@@ -1,6 +1,7 @@
1
1
  export class ActionEvent {
2
- constructor(name: any, method: any);
2
+ constructor(name: any, method: any, args: any);
3
3
  name: any;
4
4
  method: any;
5
+ args: any;
5
6
  trigger(): void;
6
7
  }
@@ -1,10 +1,11 @@
1
1
  export class ActionSequencer {
2
- constructor(context: any);
2
+ constructor(context?: {});
3
+ previous_elapsed_time: number;
3
4
  elapsed_time: number;
4
5
  playback_speed: number;
5
6
  playing: boolean;
6
7
  action_events: any[];
7
- context: any;
8
+ context: {};
8
9
  initial_context: any;
9
10
  tmp_t: number;
10
11
  channels: {};
@@ -25,6 +26,7 @@ export class ActionSequencer {
25
26
  get_current_progress(name: any): any;
26
27
  get_duration(): number;
27
28
  __play_clips(from: any, to: any): void;
29
+ __play_events(from: any, to: any): void;
28
30
  evaluate_keyframe(keyframe: any, time: any): any;
29
31
  get_keyframes(channel_name: any): any;
30
32
  is_channel_redefined(channel_name: any): boolean;
@@ -22,4 +22,15 @@ declare class CameraUtilities {
22
22
  get_html_screen_pos(object: any, camera: any): any;
23
23
  world_pos_to_screen(pos: any, camera: any): any;
24
24
  update_projection(camera: any): void;
25
+ fit_bounding_box_points(camera: any, bb: any, scale?: number): {
26
+ zoom: any;
27
+ reference_position: any;
28
+ camera_position: any;
29
+ };
30
+ fit_points(camera: any, points: any, zoom_scale?: number): {
31
+ zoom: any;
32
+ reference_position: any;
33
+ camera_position: any;
34
+ };
35
+ reference_zoom: number;
25
36
  }
@@ -1,10 +1,6 @@
1
1
  export class HTMLUtilities {
2
- /**
3
- * Load Images defined in data-src.
4
- */
5
- static load_images(container: HTMLElement): void;
6
- /**
7
- * Load Videos defined in data-src.
8
- */
9
- static load_videos(container: HTMLElement): void;
2
+ static load_images(container: any): void;
3
+ static load_videos(container: any): void;
4
+ static load_iframes(container: any): void;
5
+ static load_elements(container: any, selector: any): void;
10
6
  }
@@ -1,16 +1,7 @@
1
1
  export class ObjectUtilities {
2
- /**
3
- * Simple object check.
4
- */
5
2
  static is_object(item: any): boolean;
6
-
7
- /**
8
- * Deep merge two objects.
9
- */
10
- static merge_deep(target: any, ...sources: any): void;
11
-
12
- /**
13
- * Convert XML to JSON
14
- */
15
- static xml_to_json(xml: any): object;
3
+ static merge_deep(target: any, ...sources: any[]): any;
4
+ static xml_to_json(xml: any): {
5
+ '@attributes': {};
6
+ };
16
7
  }
@@ -6,13 +6,6 @@ export class ApplicationView extends ViewState {
6
6
  });
7
7
  container: any;
8
8
  url: any;
9
- start(): void;
10
- show(): void;
11
- before_enter(): void;
12
- on_enter(): void;
13
- before_exit(): void;
14
- on_exit(): void;
15
- update(): void;
16
9
  load_html_images(): void;
17
10
  load_html_videos(): void;
18
11
  set_opacity(current_state_data: any): void;
@@ -6,7 +6,9 @@ declare class ViewManager {
6
6
  transition_handler: ViewStateTransitionHandler;
7
7
  view_change_subscribers: any[];
8
8
  browser_title_suffix: string;
9
+ before_update(): void;
9
10
  update(): void;
11
+ fixed_update(): void;
10
12
  go_to_view(view_name: any, change_url?: boolean, skip?: boolean): void;
11
13
  go_to_scene(scene_name: any, change_url?: boolean, skip?: boolean): void;
12
14
  subscribe_to_view_change(subscriber: any): void;
@@ -32,4 +34,3 @@ declare class ViewManager {
32
34
  import { TransitionTable } from "./transition/TransitionTable";
33
35
  import { ViewStateTransitionHandler } from "./transition/ViewStateTransitionHandler";
34
36
  import { ViewState } from "./ViewState";
35
-
@@ -6,7 +6,9 @@ export class ViewState {
6
6
  hide(): void;
7
7
  before_enter(): void;
8
8
  on_enter(): void;
9
+ before_update(): void;
9
10
  update(): void;
11
+ fixed_update(): void;
10
12
  update_enter_transition(global_view_data: any, transition_progress: any, action_sequencer: any): void;
11
13
  update_exit_transition(global_view_data: any, transition_progress: any, action_sequencer: any): void;
12
14
  update_transition(global_view_data: any, transition_progress: any, action_sequencer: any): void;
@@ -9,6 +9,8 @@ export class ViewStateTransitionHandler {
9
9
  go_to_state(state: any, skip?: boolean): void;
10
10
  action_sequencer: any;
11
11
  update(): void;
12
+ before_update(): void;
13
+ fixed_update(): void;
12
14
  set_state(state: any): void;
13
15
  set_default_state_data(default_state_data: any): void;
14
16
  __update_transitions(): void;