lythreeframe 1.0.12 → 1.0.14

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.
@@ -14,6 +14,7 @@ var OutlineNode_js = require('three/examples/jsm/tsl/display/OutlineNode.js');
14
14
  var MotionBlur_js = require('three/examples/jsm/tsl/display/MotionBlur.js');
15
15
  var FXAANode_js = require('three/examples/jsm/tsl/display/FXAANode.js');
16
16
  var SMAANode_js = require('three/examples/jsm/tsl/display/SMAANode.js');
17
+ var gsap = require('gsap');
17
18
  var CSS2DRenderer_js = require('three/examples/jsm/renderers/CSS2DRenderer.js');
18
19
  var PointerLockControls = require('three/examples/jsm/controls/PointerLockControls');
19
20
  var TransformControls_js = require('three/examples/jsm/controls/TransformControls.js');
@@ -852,13 +853,9 @@ class TAssetPointer extends TSmartPointer {
852
853
  class LYAssetManager {
853
854
  constructor() {
854
855
  this.assetPointer = new Map();
856
+ this.dracoLoader = null;
855
857
  this.loadingManager = new three.LoadingManager();
856
- this.dracoLoader = new Addons_js.DRACOLoader(this.loadingManager);
857
- this.dracoLoader.setDecoderPath(`./public/draco/`);
858
- this.dracoLoader.setDecoderConfig({ type: "js" });
859
- this.dracoLoader.preload();
860
858
  this.gltfLoader = new Addons_js.GLTFLoader(this.loadingManager);
861
- this.gltfLoader.setDRACOLoader(this.dracoLoader);
862
859
  }
863
860
  get LoadingManager() {
864
861
  return this.loadingManager;
@@ -869,6 +866,13 @@ class LYAssetManager {
869
866
  static ClearAssets() {
870
867
  assetManager.clearAssets();
871
868
  }
869
+ setupDracoLoader(dracoPath) {
870
+ this.dracoLoader = new Addons_js.DRACOLoader(this.loadingManager);
871
+ this.dracoLoader.setDecoderPath(dracoPath);
872
+ this.dracoLoader.setDecoderConfig({ type: "js" });
873
+ this.dracoLoader.preload();
874
+ this.gltfLoader.setDRACOLoader(this.dracoLoader);
875
+ }
872
876
  convertThreeObjectToLYObject(parentLYComponent, threejsObject) {
873
877
  let location = threejsObject.position.clone();
874
878
  let rotation = threejsObject.rotation.clone();
@@ -1350,6 +1354,9 @@ class Viewport {
1350
1354
  }
1351
1355
  });
1352
1356
  this.resizeObserver.observe(this._canvas);
1357
+ this.app.onCameraChangedDelegate.add(() => {
1358
+ this.setupPostProcess();
1359
+ });
1353
1360
  this.setupPostProcess();
1354
1361
  }
1355
1362
  init() {
@@ -1681,6 +1688,10 @@ class Pawn {
1681
1688
  }
1682
1689
  unpossess() {
1683
1690
  }
1691
+ focusTo(targetPos, targetQuat, distance, time, onGoing = null, onFinished = null) {
1692
+ }
1693
+ stopFocusing() {
1694
+ }
1684
1695
  destroy() {
1685
1696
  }
1686
1697
  }
@@ -1692,8 +1703,12 @@ class Orbital extends Pawn {
1692
1703
  }
1693
1704
  return this._control;
1694
1705
  }
1706
+ get camera() {
1707
+ return this.controller.camera;
1708
+ }
1695
1709
  constructor(controller) {
1696
1710
  super(controller);
1711
+ this.anim = null;
1697
1712
  this.changeEvent = () => { this.onChange(); };
1698
1713
  this._control = new Addons_js.OrbitControls(controller.camera, controller.viewPort.canvas);
1699
1714
  this.control.target.set(0, 0, 0);
@@ -1711,6 +1726,71 @@ class Orbital extends Pawn {
1711
1726
  onChange() {
1712
1727
  this.controller.viewPort.markRenderStateDirty();
1713
1728
  }
1729
+ focusTo(targetPos, targetQuat, distance, time, onGoing = null, onFinished = null) {
1730
+ this.stopFocusing();
1731
+ let finalQuat = null;
1732
+ if (targetQuat instanceof three.Euler) {
1733
+ finalQuat = new three.Quaternion().setFromEuler(targetQuat);
1734
+ }
1735
+ else {
1736
+ finalQuat = targetQuat;
1737
+ }
1738
+ if (!targetQuat) {
1739
+ finalQuat = this.controller.camera.quaternion;
1740
+ }
1741
+ finalQuat.normalize();
1742
+ let dir = new three.Vector3(0, 0, 1);
1743
+ dir.applyQuaternion(finalQuat).multiplyScalar(-1);
1744
+ dir.normalize();
1745
+ // quat
1746
+ // let startQuat = this.camera.quaternion.clone();
1747
+ // position
1748
+ let startPos = this.camera.position.clone();
1749
+ let endPos = new three.Vector3(targetPos.x + dir.x * distance * -1, targetPos.y + dir.y * distance * -1, targetPos.z + dir.z * distance * -1);
1750
+ let posDir = new three.Vector3().subVectors(endPos, startPos);
1751
+ let movingLength = posDir.length();
1752
+ posDir.normalize();
1753
+ // target
1754
+ let startTarget = this.control.target.clone();
1755
+ let targetDir = new three.Vector3().subVectors(targetPos, startTarget);
1756
+ let targetDistance = targetDir.length();
1757
+ targetDir.normalize();
1758
+ // start animation
1759
+ if (movingLength + targetDistance < 0.1) {
1760
+ return;
1761
+ }
1762
+ //this.enabled = false;
1763
+ let obj = { alpha: 0 };
1764
+ this.anim = gsap.gsap.to(obj, {
1765
+ duration: time,
1766
+ alpha: 1,
1767
+ onUpdate: () => {
1768
+ let alpha = obj.alpha;
1769
+ let camPos = new three.Vector3(startPos.x + posDir.x * alpha * movingLength, startPos.y + posDir.y * alpha * movingLength, startPos.z + posDir.z * alpha * movingLength);
1770
+ let targetPos = new three.Vector3(startTarget.x + targetDir.x * alpha * targetDistance, startTarget.y + targetDir.y * alpha * targetDistance, startTarget.z + targetDir.z * alpha * targetDistance);
1771
+ this.control.object.position.copy(camPos);
1772
+ this.control.target.copy(targetPos);
1773
+ this.control.update();
1774
+ if (onGoing) {
1775
+ onGoing();
1776
+ }
1777
+ this.controller.viewPort.markRenderStateDirty();
1778
+ },
1779
+ onComplete: function () {
1780
+ //_this.enabled = true;
1781
+ if (onFinished) {
1782
+ onFinished();
1783
+ }
1784
+ this.controller.viewPort.markRenderStateDirty();
1785
+ }
1786
+ });
1787
+ }
1788
+ stopFocusing() {
1789
+ if (this.anim) {
1790
+ this.anim.kill();
1791
+ }
1792
+ this.anim = null;
1793
+ }
1714
1794
  }
1715
1795
 
1716
1796
  class Controller {
@@ -1889,6 +1969,9 @@ class Controller {
1889
1969
  }
1890
1970
  return null;
1891
1971
  }
1972
+ focusTo(targetPos, targetQuat, distance, time, onGoing = null, onFinished = null) {
1973
+ this.pawn.focusTo(targetPos, targetQuat, distance, time, onGoing, onFinished);
1974
+ }
1892
1975
  }
1893
1976
 
1894
1977
  class CameraFactory {
@@ -1934,6 +2017,7 @@ class CameraFactory {
1934
2017
  return new three.OrthographicCamera(param.param.left, param.param.right, param.param.top, param.param.bottom, param.near, param.far);
1935
2018
  }
1936
2019
  }
2020
+ return camera;
1937
2021
  }
1938
2022
  }
1939
2023
 
@@ -1978,7 +2062,11 @@ class ThreeJsApp {
1978
2062
  get controllerClass() {
1979
2063
  return Controller;
1980
2064
  }
2065
+ get onCameraChangedDelegate() {
2066
+ return this._onCameraChangedDelegate;
2067
+ }
1981
2068
  constructor(elementId, appParam = DefaultAppParam) {
2069
+ this._onCameraChangedDelegate = new Delegate();
1982
2070
  this._clock = new three.Clock();
1983
2071
  this._camera = CameraFactory.createCamera(appParam.cameraParam ? appParam.cameraParam : DefaultCameraParam);
1984
2072
  this._world = new this.worldClass(this);
@@ -2000,6 +2088,14 @@ class ThreeJsApp {
2000
2088
  this.world.tick(delta);
2001
2089
  this.viewport.render();
2002
2090
  }
2091
+ updateCamera(param) {
2092
+ const previousCam = this.camera;
2093
+ this._camera = CameraFactory.updataCamera(param, this.camera);
2094
+ if (previousCam !== this.camera) {
2095
+ this._onCameraChangedDelegate.broadcast();
2096
+ }
2097
+ this.viewport.markRenderStateDirty();
2098
+ }
2003
2099
  onWindowResize(width, height) {
2004
2100
  if (this.camera instanceof three.PerspectiveCamera) {
2005
2101
  this.camera.aspect = width / height;
@@ -2011,6 +2107,7 @@ class ThreeJsApp {
2011
2107
  this.camera.updateProjectionMatrix();
2012
2108
  }
2013
2109
  destroy() {
2110
+ this.onCameraChangedDelegate.clear();
2014
2111
  this.world.destroy();
2015
2112
  this.controller.destroy();
2016
2113
  this.viewport.destroy();
@@ -1,5 +1,5 @@
1
1
  import { MathUtils, Group, Vector3, Box3, Quaternion, Euler, Matrix4, Mesh, BufferGeometry, Material, Texture, LoadingManager, FileLoader, Scene, NoToneMapping, LinearToneMapping, ReinhardToneMapping, CineonToneMapping, ACESFilmicToneMapping, AgXToneMapping, NeutralToneMapping, Vector2, Raycaster, PerspectiveCamera, OrthographicCamera, Clock, DirectionalLight, MeshStandardMaterial, BoxGeometry, MeshBasicMaterial, PlaneGeometry, SphereGeometry, Object3D } from 'three';
2
- import { DRACOLoader, GLTFLoader, CSS2DRenderer, OrbitControls } from 'three/examples/jsm/Addons.js';
2
+ import { GLTFLoader, DRACOLoader, CSS2DRenderer, OrbitControls } from 'three/examples/jsm/Addons.js';
3
3
  import { pass, mrt, output, uniform, velocity, metalness, transformedNormalView, blendColor, time, oscSine } from 'three/tsl';
4
4
  import { WebGPURenderer, PostProcessing, Color } from 'three/webgpu';
5
5
  import { bloom } from 'three/examples/jsm/tsl/display/BloomNode.js';
@@ -12,6 +12,7 @@ import { outline } from 'three/examples/jsm/tsl/display/OutlineNode.js';
12
12
  import { motionBlur } from 'three/examples/jsm/tsl/display/MotionBlur.js';
13
13
  import { fxaa } from 'three/examples/jsm/tsl/display/FXAANode.js';
14
14
  import { smaa } from 'three/examples/jsm/tsl/display/SMAANode.js';
15
+ import { gsap } from 'gsap';
15
16
  import { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer.js';
16
17
  import { PointerLockControls } from 'three/examples/jsm/controls/PointerLockControls';
17
18
  import { TransformControls } from 'three/examples/jsm/controls/TransformControls.js';
@@ -850,13 +851,9 @@ class TAssetPointer extends TSmartPointer {
850
851
  class LYAssetManager {
851
852
  constructor() {
852
853
  this.assetPointer = new Map();
854
+ this.dracoLoader = null;
853
855
  this.loadingManager = new LoadingManager();
854
- this.dracoLoader = new DRACOLoader(this.loadingManager);
855
- this.dracoLoader.setDecoderPath(`./public/draco/`);
856
- this.dracoLoader.setDecoderConfig({ type: "js" });
857
- this.dracoLoader.preload();
858
856
  this.gltfLoader = new GLTFLoader(this.loadingManager);
859
- this.gltfLoader.setDRACOLoader(this.dracoLoader);
860
857
  }
861
858
  get LoadingManager() {
862
859
  return this.loadingManager;
@@ -867,6 +864,13 @@ class LYAssetManager {
867
864
  static ClearAssets() {
868
865
  assetManager.clearAssets();
869
866
  }
867
+ setupDracoLoader(dracoPath) {
868
+ this.dracoLoader = new DRACOLoader(this.loadingManager);
869
+ this.dracoLoader.setDecoderPath(dracoPath);
870
+ this.dracoLoader.setDecoderConfig({ type: "js" });
871
+ this.dracoLoader.preload();
872
+ this.gltfLoader.setDRACOLoader(this.dracoLoader);
873
+ }
870
874
  convertThreeObjectToLYObject(parentLYComponent, threejsObject) {
871
875
  let location = threejsObject.position.clone();
872
876
  let rotation = threejsObject.rotation.clone();
@@ -1348,6 +1352,9 @@ class Viewport {
1348
1352
  }
1349
1353
  });
1350
1354
  this.resizeObserver.observe(this._canvas);
1355
+ this.app.onCameraChangedDelegate.add(() => {
1356
+ this.setupPostProcess();
1357
+ });
1351
1358
  this.setupPostProcess();
1352
1359
  }
1353
1360
  init() {
@@ -1679,6 +1686,10 @@ class Pawn {
1679
1686
  }
1680
1687
  unpossess() {
1681
1688
  }
1689
+ focusTo(targetPos, targetQuat, distance, time, onGoing = null, onFinished = null) {
1690
+ }
1691
+ stopFocusing() {
1692
+ }
1682
1693
  destroy() {
1683
1694
  }
1684
1695
  }
@@ -1690,8 +1701,12 @@ class Orbital extends Pawn {
1690
1701
  }
1691
1702
  return this._control;
1692
1703
  }
1704
+ get camera() {
1705
+ return this.controller.camera;
1706
+ }
1693
1707
  constructor(controller) {
1694
1708
  super(controller);
1709
+ this.anim = null;
1695
1710
  this.changeEvent = () => { this.onChange(); };
1696
1711
  this._control = new OrbitControls(controller.camera, controller.viewPort.canvas);
1697
1712
  this.control.target.set(0, 0, 0);
@@ -1709,6 +1724,71 @@ class Orbital extends Pawn {
1709
1724
  onChange() {
1710
1725
  this.controller.viewPort.markRenderStateDirty();
1711
1726
  }
1727
+ focusTo(targetPos, targetQuat, distance, time, onGoing = null, onFinished = null) {
1728
+ this.stopFocusing();
1729
+ let finalQuat = null;
1730
+ if (targetQuat instanceof Euler) {
1731
+ finalQuat = new Quaternion().setFromEuler(targetQuat);
1732
+ }
1733
+ else {
1734
+ finalQuat = targetQuat;
1735
+ }
1736
+ if (!targetQuat) {
1737
+ finalQuat = this.controller.camera.quaternion;
1738
+ }
1739
+ finalQuat.normalize();
1740
+ let dir = new Vector3(0, 0, 1);
1741
+ dir.applyQuaternion(finalQuat).multiplyScalar(-1);
1742
+ dir.normalize();
1743
+ // quat
1744
+ // let startQuat = this.camera.quaternion.clone();
1745
+ // position
1746
+ let startPos = this.camera.position.clone();
1747
+ let endPos = new Vector3(targetPos.x + dir.x * distance * -1, targetPos.y + dir.y * distance * -1, targetPos.z + dir.z * distance * -1);
1748
+ let posDir = new Vector3().subVectors(endPos, startPos);
1749
+ let movingLength = posDir.length();
1750
+ posDir.normalize();
1751
+ // target
1752
+ let startTarget = this.control.target.clone();
1753
+ let targetDir = new Vector3().subVectors(targetPos, startTarget);
1754
+ let targetDistance = targetDir.length();
1755
+ targetDir.normalize();
1756
+ // start animation
1757
+ if (movingLength + targetDistance < 0.1) {
1758
+ return;
1759
+ }
1760
+ //this.enabled = false;
1761
+ let obj = { alpha: 0 };
1762
+ this.anim = gsap.to(obj, {
1763
+ duration: time,
1764
+ alpha: 1,
1765
+ onUpdate: () => {
1766
+ let alpha = obj.alpha;
1767
+ let camPos = new Vector3(startPos.x + posDir.x * alpha * movingLength, startPos.y + posDir.y * alpha * movingLength, startPos.z + posDir.z * alpha * movingLength);
1768
+ let targetPos = new Vector3(startTarget.x + targetDir.x * alpha * targetDistance, startTarget.y + targetDir.y * alpha * targetDistance, startTarget.z + targetDir.z * alpha * targetDistance);
1769
+ this.control.object.position.copy(camPos);
1770
+ this.control.target.copy(targetPos);
1771
+ this.control.update();
1772
+ if (onGoing) {
1773
+ onGoing();
1774
+ }
1775
+ this.controller.viewPort.markRenderStateDirty();
1776
+ },
1777
+ onComplete: function () {
1778
+ //_this.enabled = true;
1779
+ if (onFinished) {
1780
+ onFinished();
1781
+ }
1782
+ this.controller.viewPort.markRenderStateDirty();
1783
+ }
1784
+ });
1785
+ }
1786
+ stopFocusing() {
1787
+ if (this.anim) {
1788
+ this.anim.kill();
1789
+ }
1790
+ this.anim = null;
1791
+ }
1712
1792
  }
1713
1793
 
1714
1794
  class Controller {
@@ -1887,6 +1967,9 @@ class Controller {
1887
1967
  }
1888
1968
  return null;
1889
1969
  }
1970
+ focusTo(targetPos, targetQuat, distance, time, onGoing = null, onFinished = null) {
1971
+ this.pawn.focusTo(targetPos, targetQuat, distance, time, onGoing, onFinished);
1972
+ }
1890
1973
  }
1891
1974
 
1892
1975
  class CameraFactory {
@@ -1932,6 +2015,7 @@ class CameraFactory {
1932
2015
  return new OrthographicCamera(param.param.left, param.param.right, param.param.top, param.param.bottom, param.near, param.far);
1933
2016
  }
1934
2017
  }
2018
+ return camera;
1935
2019
  }
1936
2020
  }
1937
2021
 
@@ -1976,7 +2060,11 @@ class ThreeJsApp {
1976
2060
  get controllerClass() {
1977
2061
  return Controller;
1978
2062
  }
2063
+ get onCameraChangedDelegate() {
2064
+ return this._onCameraChangedDelegate;
2065
+ }
1979
2066
  constructor(elementId, appParam = DefaultAppParam) {
2067
+ this._onCameraChangedDelegate = new Delegate();
1980
2068
  this._clock = new Clock();
1981
2069
  this._camera = CameraFactory.createCamera(appParam.cameraParam ? appParam.cameraParam : DefaultCameraParam);
1982
2070
  this._world = new this.worldClass(this);
@@ -1998,6 +2086,14 @@ class ThreeJsApp {
1998
2086
  this.world.tick(delta);
1999
2087
  this.viewport.render();
2000
2088
  }
2089
+ updateCamera(param) {
2090
+ const previousCam = this.camera;
2091
+ this._camera = CameraFactory.updataCamera(param, this.camera);
2092
+ if (previousCam !== this.camera) {
2093
+ this._onCameraChangedDelegate.broadcast();
2094
+ }
2095
+ this.viewport.markRenderStateDirty();
2096
+ }
2001
2097
  onWindowResize(width, height) {
2002
2098
  if (this.camera instanceof PerspectiveCamera) {
2003
2099
  this.camera.aspect = width / height;
@@ -2009,6 +2105,7 @@ class ThreeJsApp {
2009
2105
  this.camera.updateProjectionMatrix();
2010
2106
  }
2011
2107
  destroy() {
2108
+ this.onCameraChangedDelegate.clear();
2012
2109
  this.world.destroy();
2013
2110
  this.controller.destroy();
2014
2111
  this.viewport.destroy();
@@ -5,13 +5,14 @@ import { TAssetPointer } from "./AssetPointer/AssetPointer";
5
5
  import { DRACOLoader, GLTF, GLTFLoader } from 'three/examples/jsm/Addons.js';
6
6
  export declare class LYAssetManager {
7
7
  protected assetPointer: Map<string, TAssetPointer<BufferGeometry | Texture | Material>>;
8
- protected readonly dracoLoader: DRACOLoader;
8
+ protected dracoLoader: DRACOLoader | null;
9
9
  protected readonly gltfLoader: GLTFLoader;
10
10
  protected readonly loadingManager: LoadingManager;
11
11
  constructor();
12
12
  get LoadingManager(): LoadingManager;
13
13
  static Get(): LYAssetManager;
14
14
  static ClearAssets(): void;
15
+ setupDracoLoader(dracoPath: string): void;
15
16
  convertThreeObjectToLYObject(parentLYComponent: SceneComponent, threejsObject: any): SceneComponent | null;
16
17
  private collectResourcesAndReferences;
17
18
  checkMeshResource(mesh: Mesh): void;
@@ -16,5 +16,5 @@ export interface OrthographicCameraParam {
16
16
  }
17
17
  export declare class CameraFactory {
18
18
  static createCamera(param: CameraParam): PerspectiveCamera | OrthographicCamera;
19
- static updataCamera(param: CameraParam, camera: PerspectiveCamera | OrthographicCamera): PerspectiveCamera | OrthographicCamera | undefined;
19
+ static updataCamera(param: CameraParam, camera: PerspectiveCamera | OrthographicCamera): PerspectiveCamera | OrthographicCamera;
20
20
  }
@@ -1,5 +1,5 @@
1
1
  import { ThreeJsApp } from "../ThreeJsApp";
2
- import { Intersection, OrthographicCamera, PerspectiveCamera } from "three";
2
+ import { Euler, Intersection, OrthographicCamera, PerspectiveCamera, Quaternion, Vector3 } from "three";
3
3
  import { World } from "./World";
4
4
  import { Viewport } from "./Viewport";
5
5
  import { Pawn } from "../Object/PawnV2/Pawn";
@@ -37,4 +37,5 @@ export declare class Controller {
37
37
  onPointerLeaveEvent(event: MouseEvent): void;
38
38
  getHitResultUnderCursor(): Intersection | null;
39
39
  getHitResultFromScreenPoint(x: number, y: number): Intersection | null;
40
+ focusTo(targetPos: Vector3, targetQuat: Quaternion | Euler, distance: number, time: number, onGoing?: (() => void) | null, onFinished?: (() => void) | null): void;
40
41
  }
@@ -1,12 +1,17 @@
1
1
  import { Pawn } from "./Pawn";
2
2
  import { Controller } from "../../Frame/Controller";
3
3
  import { OrbitControls } from "three/examples/jsm/Addons.js";
4
+ import { Euler, Quaternion, Vector3 } from "three";
4
5
  export declare class Orbital extends Pawn {
6
+ private anim;
5
7
  get control(): OrbitControls;
6
8
  protected _control: OrbitControls;
7
9
  protected changeEvent: () => void;
10
+ get camera(): import("three").PerspectiveCamera | import("three").OrthographicCamera;
8
11
  constructor(controller: Controller);
9
12
  possess(): void;
10
13
  unpossess(): void;
11
14
  onChange(): void;
15
+ focusTo(targetPos: Vector3, targetQuat: Quaternion | Euler, distance: number, time: number, onGoing?: (() => void) | null, onFinished?: (() => void) | null): void;
16
+ stopFocusing(): void;
12
17
  }
@@ -1,3 +1,4 @@
1
+ import { Euler, Quaternion, Vector3 } from "three";
1
2
  import { Controller } from "../../Frame/Controller";
2
3
  export declare abstract class Pawn {
3
4
  get camera(): import("three").PerspectiveCamera | import("three").OrthographicCamera;
@@ -10,5 +11,7 @@ export declare abstract class Pawn {
10
11
  tick(deltaTime: number): void;
11
12
  possess(): void;
12
13
  unpossess(): void;
14
+ focusTo(targetPos: Vector3, targetQuat: Quaternion | Euler, distance: number, time: number, onGoing?: (() => void) | null, onFinished?: (() => void) | null): void;
15
+ stopFocusing(): void;
13
16
  destroy(): void;
14
17
  }
@@ -5,6 +5,7 @@ import { Controller } from "./Frame/Controller";
5
5
  import { Clock, OrthographicCamera, PerspectiveCamera } from "three";
6
6
  import { CameraParam } from "./Factory/CameraFactory";
7
7
  import { WebGPURendererParameters } from 'three/src/renderers/webgpu/WebGPURenderer.js';
8
+ import { Delegate } from './Delegate';
8
9
  export interface AppParam {
9
10
  renderParam?: WebGPURendererParameters;
10
11
  cameraParam?: CameraParam;
@@ -27,9 +28,12 @@ export declare class ThreeJsApp {
27
28
  protected _world: World;
28
29
  protected _viewport: Viewport;
29
30
  protected _controller: Controller;
31
+ get onCameraChangedDelegate(): Delegate<[void]>;
32
+ protected _onCameraChangedDelegate: Delegate<[void]>;
30
33
  constructor(elementId: string, appParam?: AppParam);
31
34
  init(): void;
32
35
  tick(): void;
36
+ updateCamera(param: CameraParam): void;
33
37
  onWindowResize(width: number, height: number): void;
34
38
  destroy(): void;
35
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lythreeframe",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "Three.js 封装",
5
5
  "main": "dist/bundle.cjs.js",
6
6
  "module": "dist/bundle.esm.js",
@@ -16,9 +16,7 @@
16
16
  "@types/three": "^0.173.0"
17
17
  },
18
18
  "files": [
19
- "dist",
20
- "public",
21
- "public/draco"
19
+ "dist"
22
20
  ],
23
21
  "devDependencies": {
24
22
  "@rollup/plugin-typescript": "^12.1.2",
@@ -1,32 +0,0 @@
1
- # Draco 3D Data Compression
2
-
3
- Draco is an open-source library for compressing and decompressing 3D geometric meshes and point clouds. It is intended to improve the storage and transmission of 3D graphics.
4
-
5
- [Website](https://google.github.io/draco/) | [GitHub](https://github.com/google/draco)
6
-
7
- ## Contents
8
-
9
- This folder contains three utilities:
10
-
11
- * `draco_decoder.js` — Emscripten-compiled decoder, compatible with any modern browser.
12
- * `draco_decoder.wasm` — WebAssembly decoder, compatible with newer browsers and devices.
13
- * `draco_wasm_wrapper.js` — JavaScript wrapper for the WASM decoder.
14
-
15
- Each file is provided in two variations:
16
-
17
- * **Default:** Latest stable builds, tracking the project's [master branch](https://github.com/google/draco).
18
- * **glTF:** Builds targeted by the [glTF mesh compression extension](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression), tracking the [corresponding Draco branch](https://github.com/google/draco/tree/gltf_2.0_draco_extension).
19
-
20
- Either variation may be used with `THREE.DRACOLoader`:
21
-
22
- ```js
23
- var dracoLoader = new THREE.DRACOLoader();
24
- dracoLoader.setDecoderPath('path/to/decoders/');
25
- dracoLoader.setDecoderConfig({type: 'js'}); // (Optional) Override detection of WASM support.
26
- ```
27
-
28
- Further [documentation on GitHub](https://github.com/google/draco/tree/master/javascript/example#static-loading-javascript-decoder).
29
-
30
- ## License
31
-
32
- [Apache License 2.0](https://github.com/google/draco/blob/master/LICENSE)