lythreeframe 1.0.11 → 1.0.13

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.
@@ -852,13 +852,9 @@ class TAssetPointer extends TSmartPointer {
852
852
  class LYAssetManager {
853
853
  constructor() {
854
854
  this.assetPointer = new Map();
855
+ this.dracoLoader = null;
855
856
  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
857
  this.gltfLoader = new Addons_js.GLTFLoader(this.loadingManager);
861
- this.gltfLoader.setDRACOLoader(this.dracoLoader);
862
858
  }
863
859
  get LoadingManager() {
864
860
  return this.loadingManager;
@@ -869,6 +865,13 @@ class LYAssetManager {
869
865
  static ClearAssets() {
870
866
  assetManager.clearAssets();
871
867
  }
868
+ setupDracoLoader(dracoPath) {
869
+ this.dracoLoader = new Addons_js.DRACOLoader(this.loadingManager);
870
+ this.dracoLoader.setDecoderPath(dracoPath);
871
+ this.dracoLoader.setDecoderConfig({ type: "js" });
872
+ this.dracoLoader.preload();
873
+ this.gltfLoader.setDRACOLoader(this.dracoLoader);
874
+ }
872
875
  convertThreeObjectToLYObject(parentLYComponent, threejsObject) {
873
876
  let location = threejsObject.position.clone();
874
877
  let rotation = threejsObject.rotation.clone();
@@ -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';
@@ -850,13 +850,9 @@ class TAssetPointer extends TSmartPointer {
850
850
  class LYAssetManager {
851
851
  constructor() {
852
852
  this.assetPointer = new Map();
853
+ this.dracoLoader = null;
853
854
  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
855
  this.gltfLoader = new GLTFLoader(this.loadingManager);
859
- this.gltfLoader.setDRACOLoader(this.dracoLoader);
860
856
  }
861
857
  get LoadingManager() {
862
858
  return this.loadingManager;
@@ -867,6 +863,13 @@ class LYAssetManager {
867
863
  static ClearAssets() {
868
864
  assetManager.clearAssets();
869
865
  }
866
+ setupDracoLoader(dracoPath) {
867
+ this.dracoLoader = new DRACOLoader(this.loadingManager);
868
+ this.dracoLoader.setDecoderPath(dracoPath);
869
+ this.dracoLoader.setDecoderConfig({ type: "js" });
870
+ this.dracoLoader.preload();
871
+ this.gltfLoader.setDRACOLoader(this.dracoLoader);
872
+ }
870
873
  convertThreeObjectToLYObject(parentLYComponent, threejsObject) {
871
874
  let location = threejsObject.position.clone();
872
875
  let rotation = threejsObject.rotation.clone();
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lythreeframe",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
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)