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/build/index.module.js +1 -1
- package/build/index.module.js.map +1 -1
- package/package.json +1 -1
- package/src/BaseApplication.js +3 -0
- package/src/Browser.js +7 -7
- package/src/RenderLoop.js +4 -0
- package/src/view_components/ViewManager.js +10 -0
- package/src/view_components/ViewState.js +8 -0
- package/src/view_components/transition/ViewStateTransitionHandler.js +10 -0
- package/types/BaseApplication.d.ts +2 -0
- package/types/Browser.d.ts +4 -0
- package/types/Graphics.d.ts +10 -5
- package/types/KeyboardInput.d.ts +1 -1
- package/types/RenderLoop.d.ts +1 -0
- package/types/Time.d.ts +13 -4
- package/types/action_sequencer/ActionEvent.d.ts +2 -1
- package/types/action_sequencer/ActionSequencer.d.ts +4 -2
- package/types/utilities/CameraUtilities.d.ts +11 -0
- package/types/utilities/HTMLUtilities.d.ts +4 -8
- package/types/utilities/ObjectUtilities.d.ts +4 -13
- package/types/view_components/ApplicationView.d.ts +0 -7
- package/types/view_components/ViewManager.d.ts +2 -1
- package/types/view_components/ViewState.d.ts +2 -0
- package/types/view_components/transition/ViewStateTransitionHandler.d.ts +2 -0
package/package.json
CHANGED
package/src/BaseApplication.js
CHANGED
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.
|
|
11
|
-
this.
|
|
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.
|
|
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.
|
|
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.
|
package/types/Browser.d.ts
CHANGED
|
@@ -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";
|
package/types/Graphics.d.ts
CHANGED
|
@@ -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
|
-
|
|
19
|
-
|
|
19
|
+
failIfMajorPerformanceCaveat: boolean;
|
|
20
|
+
powerPreference: string;
|
|
20
21
|
premultipliedAlpha: boolean;
|
|
21
22
|
preserveDrawingBuffer: boolean;
|
|
22
|
-
|
|
23
|
-
|
|
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;
|
package/types/KeyboardInput.d.ts
CHANGED
package/types/RenderLoop.d.ts
CHANGED
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
|
-
|
|
4
|
+
__delta_buffer: number[];
|
|
5
5
|
init(): void;
|
|
6
6
|
___time: any;
|
|
7
|
-
|
|
7
|
+
__delta_time: any;
|
|
8
|
+
__smooth_delta_time: any;
|
|
8
9
|
__elapsed_time: any;
|
|
9
10
|
__allocated_time: any;
|
|
10
|
-
|
|
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
|
-
|
|
23
|
+
__calculate_smooth_delta_time(): void;
|
|
15
24
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export class ActionSequencer {
|
|
2
|
-
constructor(context
|
|
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:
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
static
|
|
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
|
-
|
|
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;
|