ohzi-core 10.2.0 → 10.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ohzi-core",
3
- "version": "10.2.0",
3
+ "version": "10.3.0",
4
4
  "description": "OHZI Core Library",
5
5
  "source": "src/index.js",
6
6
  "module": "build/index.module.js",
@@ -45,6 +45,11 @@
45
45
  "dependencies": {
46
46
  "three": "0.148.0"
47
47
  },
48
+ "standardx": {
49
+ "ignore": [
50
+ "rollup.config.js"
51
+ ]
52
+ },
48
53
  "devDependencies": {
49
54
  "cross-var": "^1.1.0",
50
55
  "rollup": "^2.44.0",
package/src/Graphics.js CHANGED
@@ -22,7 +22,7 @@ import { WebGLRenderer } from 'three';
22
22
 
23
23
  class Graphics
24
24
  {
25
- init(canvas, context_attributes)
25
+ init(canvas, core_attributes, context_attributes, threejs_attributes)
26
26
  {
27
27
  this._renderer = undefined;
28
28
  this.blitter = undefined;
@@ -36,23 +36,34 @@ class Graphics
36
36
  this.canvas_context = undefined;
37
37
  this.context_attributes = undefined;
38
38
 
39
+ this.core_attributes = {
40
+ force_webgl2: true,
41
+ xr_enabled: false
42
+ };
43
+
39
44
  this.context_attributes = {
40
45
  alpha: true,
46
+ antialias: false,
41
47
  depth: true,
42
48
  desynchronized: false,
43
- stencil: false,
44
- antialias: false,
49
+ failIfMajorPerformanceCaveat: false,
50
+ powerPreference: 'high-performance',
45
51
  premultipliedAlpha: true,
46
52
  preserveDrawingBuffer: true,
47
- powerPreference: 'high-performance',
48
- logarithmicDepthBuffer: false,
49
- force_webgl2: true,
50
- xr_enabled: false
53
+ stencil: false
54
+ };
55
+
56
+ this.threejs_attributes = {
57
+ logarithmicDepthBuffer: false
51
58
  };
52
59
 
60
+ Object.assign(this.core_attributes, core_attributes);
53
61
  Object.assign(this.context_attributes, context_attributes);
54
62
 
55
- if (this.context_attributes.force_webgl2)
63
+ Object.assign(this.threejs_attributes, this.context_attributes);
64
+ Object.assign(this.threejs_attributes, threejs_attributes);
65
+
66
+ if (this.core_attributes.force_webgl2)
56
67
  {
57
68
  this.canvas_context = canvas.getContext('webgl2', this.context_attributes) ||
58
69
  canvas.getContext('webgl', this.context_attributes) ||
@@ -68,12 +79,12 @@ class Graphics
68
79
 
69
80
  // console.log(`Using WebGL ${this.is_webgl2 ? 2 : 1}`);
70
81
 
71
- this._renderer = new WebGLRenderer({
72
- canvas: canvas,
73
- context: this.canvas_context
74
- });
82
+ this.threejs_attributes.canvas = canvas;
83
+ this.threejs_attributes.context = this.canvas_context;
84
+
85
+ this._renderer = new WebGLRenderer(this.threejs_attributes);
75
86
 
76
- if (this.context_attributes.xr_enabled)
87
+ if (this.core_attributes.xr_enabled)
77
88
  {
78
89
  this._renderer.xr.enabled = true;
79
90
  }
@@ -21,7 +21,7 @@ class Initializer
21
21
  {
22
22
  }
23
23
 
24
- init(canvas, context_attributes, input)
24
+ init(input)
25
25
  {
26
26
  CameraManager.init();
27
27
  CameraUtilities.init(input);
@@ -39,7 +39,6 @@ class Initializer
39
39
  Time.init();
40
40
  UI.init(input);
41
41
 
42
- Graphics.init(canvas, context_attributes);
43
42
  Debug.init();
44
43
  }
45
44
 
@@ -20,15 +20,16 @@ class KeyboardInput
20
20
  this.ctrlz_pressed = true;
21
21
  this.ctrlz_fired = true;
22
22
  }
23
- if (e.key)
23
+
24
+ if (e.code)
24
25
  {
25
- this.press_key(e.key);
26
+ this.press_key(e.code);
26
27
  }
27
28
  }
28
29
 
29
30
  on_key_up(e)
30
31
  {
31
- this.release_key(e.key);
32
+ this.release_key(e.code);
32
33
  }
33
34
 
34
35
  clear()
@@ -1,6 +1,6 @@
1
1
  export { initializer as Initializer };
2
2
  declare const initializer: Initializer;
3
3
  declare class Initializer {
4
- init(canvas: any, context_attributes: any, input: any): void;
4
+ init(input: any): void;
5
5
  dispose(render_loop: any): void;
6
6
  }