ohzi-core 13.0.5 → 13.0.7

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": "13.0.5",
3
+ "version": "13.0.7",
4
4
  "description": "OHZI Interactive Core Library",
5
5
  "type": "module",
6
6
  "source": "src/index.ts",
package/src/Graphics.ts CHANGED
@@ -59,7 +59,7 @@ class Graphics
59
59
  }
60
60
 
61
61
  OScreen.dpr = dpr;
62
- this._renderer.setPixelRatio(1);
62
+ this._renderer.setPixelRatio(dpr);
63
63
 
64
64
  this.blitter = new Blitter(this._renderer);
65
65
 
@@ -137,7 +137,7 @@ class ActionSequencer
137
137
  this.channels[interpolator.attribute_name].push(keyframe);
138
138
  }
139
139
 
140
- get_current_target_value(name: string)
140
+ get_current_target_value(name: string): number
141
141
  {
142
142
  const keyframe = this.__get_current_keyframe(name, this.elapsed_time);
143
143
 
@@ -149,14 +149,14 @@ class ActionSequencer
149
149
  return keyframe.interpolator.evaluate(1);
150
150
  }
151
151
 
152
- get_current_starting_value(name: string)
152
+ get_current_starting_value(name: string): number
153
153
  {
154
154
  const keyframe = this.__get_current_keyframe(name, this.elapsed_time);
155
155
 
156
156
  return keyframe.interpolator.evaluate(0);
157
157
  }
158
158
 
159
- get_current_progress(name: string)
159
+ get_current_progress(name: string): number
160
160
  {
161
161
  const keyframe = this.__get_current_keyframe(name, this.elapsed_time);
162
162
  const t = this.__linear_map_01(this.elapsed_time, keyframe.from, keyframe.to);
@@ -22,7 +22,7 @@ import { AbstractCameraState } from './states/common/AbstractCameraState';
22
22
  export class CameraController
23
23
  {
24
24
  __last_reference_position: Vector3;
25
- camera: Camera;
25
+ camera: PerspectiveCamera;
26
26
  camera_initial_pos: Vector3;
27
27
  camera_initial_rot: Quaternion;
28
28
  current_azimuth: number;
@@ -292,11 +292,11 @@ export class CameraController
292
292
  const object_aspect = obj_x / obj_y;
293
293
  if (OScreen.aspect_ratio / object_aspect > 1)
294
294
  {
295
- (this.camera as PerspectiveCamera).zoom = OScreen.height / obj_y;
295
+ (this.camera).zoom = OScreen.height / obj_y;
296
296
  }
297
297
  else
298
298
  {
299
- (this.camera as PerspectiveCamera).zoom = OScreen.width / obj_x;
299
+ (this.camera).zoom = OScreen.width / obj_x;
300
300
  }
301
301
 
302
302
  bb.getCenter(this.reference_position);
@@ -375,8 +375,8 @@ export class CameraController
375
375
 
376
376
  get_zoom_to_sphere(sphere: Sphere, debug: boolean)
377
377
  {
378
- const v_fov = ((this.camera as PerspectiveCamera).fov / 2) * Math.PI / 180;
379
- const h_fov = (2 * Math.atan(Math.tan(v_fov) * (this.camera as PerspectiveCamera).aspect)) / 2;
378
+ const v_fov = ((this.camera).fov / 2) * Math.PI / 180;
379
+ const h_fov = (2 * Math.atan(Math.tan(v_fov) * (this.camera).aspect)) / 2;
380
380
 
381
381
  // if(debug )
382
382
  // {
@@ -425,7 +425,7 @@ export class CameraController
425
425
 
426
426
  fit_points(quaternion: Quaternion, points: Vector3[], zoom_scale = 1)
427
427
  {
428
- if ((this.camera as PerspectiveCamera).isPerspectiveCamera)
428
+ if ((this.camera).isPerspectiveCamera)
429
429
  {
430
430
  const camera_forward_dir = new Vector3(0, 0, -1).applyQuaternion(quaternion);
431
431
  const camera_backward_dir = camera_forward_dir.clone().multiplyScalar(-1);
@@ -434,7 +434,7 @@ export class CameraController
434
434
 
435
435
  const aspect_ratio = OScreen.aspect_ratio;
436
436
 
437
- const camera_pos = fitter.fit_points(points, quaternion, ((this.camera as PerspectiveCamera).fov * zoom_scale), aspect_ratio);
437
+ const camera_pos = fitter.fit_points(points, quaternion, ((this.camera).fov * zoom_scale), aspect_ratio);
438
438
  const box = new Box3().setFromPoints(points);
439
439
  const center = new Vector3();
440
440
  box.getCenter(center);
@@ -457,7 +457,7 @@ export class CameraController
457
457
  else
458
458
  {
459
459
  const fitter = new OrthographicFrustumPointFitter();
460
- const result = fitter.fit_points(points, this.reference_rotation, ((this.camera as PerspectiveCamera).fov * zoom_scale), OScreen.aspect_ratio);
460
+ const result = fitter.fit_points(points, this.reference_rotation, ((this.camera).fov * zoom_scale), OScreen.aspect_ratio);
461
461
 
462
462
  this.reference_position.copy(result.center);
463
463
  this.reference_zoom = result.distance_to_center;
@@ -473,7 +473,7 @@ export class CameraController
473
473
 
474
474
  focus_camera_on_points(points: Vector3[], zoom_scale = 1)
475
475
  {
476
- if ((this.camera as PerspectiveCamera).isPerspectiveCamera)
476
+ if ((this.camera).isPerspectiveCamera)
477
477
  {
478
478
  const camera_forward_dir = new Vector3(0, 0, -1).applyQuaternion(this.reference_rotation);
479
479
  const camera_backward_dir = camera_forward_dir.clone().multiplyScalar(-1);
@@ -482,7 +482,7 @@ export class CameraController
482
482
 
483
483
  const aspect_ratio = OScreen.aspect_ratio;
484
484
 
485
- const camera_pos = fitter.fit_points(points, this.reference_rotation, ((this.camera as PerspectiveCamera).fov * zoom_scale), aspect_ratio);
485
+ const camera_pos = fitter.fit_points(points, this.reference_rotation, ((this.camera).fov * zoom_scale), aspect_ratio);
486
486
  const box = new Box3().setFromPoints(points);
487
487
  const center = new Vector3();
488
488
  box.getCenter(center);
@@ -502,7 +502,7 @@ export class CameraController
502
502
  else
503
503
  {
504
504
  const fitter = new OrthographicFrustumPointFitter();
505
- const result = fitter.fit_points(points, this.reference_rotation, ((this.camera as PerspectiveCamera).fov * zoom_scale), OScreen.aspect_ratio);
505
+ const result = fitter.fit_points(points, this.reference_rotation, ((this.camera).fov * zoom_scale), OScreen.aspect_ratio);
506
506
 
507
507
  this.reference_position.copy(result.center);
508
508
  this.reference_zoom = result.distance_to_center;
@@ -527,8 +527,8 @@ export class CameraController
527
527
  __get_zoom_to_show_rect(width: number, height: number, scale = 1)
528
528
  {
529
529
  // let v_fov = (this.camera.fov/2) * Math.PI/180;
530
- const v_fov = OMath.degToRad((this.camera as PerspectiveCamera).fov / 2);
531
- const h_fov = (2 * Math.atan(Math.tan(v_fov) * (this.camera as PerspectiveCamera).aspect)) / 2;
530
+ const v_fov = OMath.degToRad((this.camera).fov / 2);
531
+ const h_fov = (2 * Math.atan(Math.tan(v_fov) * (this.camera).aspect)) / 2;
532
532
 
533
533
  const distV = height / Math.tan(v_fov * scale);
534
534
  const distH = width / Math.tan(h_fov * scale);
@@ -1,7 +1,6 @@
1
1
  import { Vector2 } from 'three';
2
2
 
3
3
  import type { Input } from '../../../lib/Input';
4
- import type { PerspectiveCamera } from '../../../PerspectiveCamera';
5
4
  import { Time } from '../../../Time';
6
5
  import { CameraUtilities } from '../../../utilities/CameraUtilities';
7
6
  import type { CameraController } from '../../CameraController';
@@ -71,7 +70,7 @@ export class CommonCameraState extends AbstractCameraState
71
70
  tilt: camera_controller.current_tilt,
72
71
  azimuth: camera_controller.current_azimuth,
73
72
  zoom: camera_controller.reference_zoom,
74
- fov: (camera_controller.camera as PerspectiveCamera).fov
73
+ fov: (camera_controller.camera).fov
75
74
  });
76
75
  }
77
76
  }