soonspacejs 2.5.36 → 2.5.38

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": "soonspacejs",
3
- "version": "2.5.36",
3
+ "version": "2.5.38",
4
4
  "homepage": "http://www.xwbuilders.com:8800/",
5
5
  "description": "soonspacejs 2.x",
6
6
  "module": "./dist/index.esm.js",
@@ -26,5 +26,5 @@
26
26
  "@tweenjs/tween.js": "^18.6.4",
27
27
  "@types/three": "0.141.0"
28
28
  },
29
- "gitHead": "33821c3eadbc24f0d138169c4caac601b6dae52a"
29
+ "gitHead": "9051e6bf77eb4e83262dacc437aa7c49f4450817"
30
30
  }
package/types/index.d.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  */
9
9
  import { TransformControls } from 'three/examples/jsm/controls/TransformControls.js';
10
10
  import { Reflector } from 'three/examples/jsm/objects/Reflector.js';
11
- import { Object3D, Vector3, Euler, Box3, AnimationClip, AnimationAction, Light, AmbientLight, DirectionalLight, HemisphereLight, SpotLight, PointLight, RectAreaLight } from 'three';
11
+ import { Object3D, Vector3, Euler, Box3, AnimationClip, AnimationAction, Light, AmbientLight, DirectionalLight, HemisphereLight, SpotLight, PointLight, RectAreaLight, Texture, Mesh } from 'three';
12
12
  import * as shared from './Shared';
13
13
  import Animation from './Animation';
14
14
  import * as library from './Library';
@@ -319,7 +319,7 @@ export declare class SoonSpace {
319
319
  * 设置场景环境
320
320
  * @returns
321
321
  */
322
- setEnvironment(): THREE.Texture;
322
+ setEnvironment(): Texture;
323
323
  /**
324
324
  * 播放模型动画
325
325
  * @param model
@@ -951,6 +951,7 @@ export declare class SoonSpace {
951
951
  * 隐藏所有 PoiNode
952
952
  */
953
953
  hideAllPoiNode(): void;
954
+ protected textureCache: Map<string, Texture>;
954
955
  /**
955
956
  * 创建 poi mesh
956
957
  * @param options
@@ -963,6 +964,14 @@ export declare class SoonSpace {
963
964
  * @returns
964
965
  */
965
966
  createPolygonPoiMesh(options: CreatePolygonPoiMeshOptions): library.BaseMesh;
967
+ /**
968
+ * 给 mesh 设置纹理贴图
969
+ * @param mesh - 需要设置的 Mesh 对象
970
+ * @param image - 图片 url ,或 图片元素、Canvas元素、Video 元素
971
+ * @param cache - 是丰使用缓存中的材质
972
+ * @returns 返回设置的纹理对象
973
+ */
974
+ setTexture(mesh: Mesh, image: string | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, cache?: boolean): Texture | THREE.CanvasTexture | THREE.VideoTexture;
966
975
  /******/
967
976
  /******/
968
977
  /******* Canvas3D methods */
@@ -1,4 +1,4 @@
1
- import { Texture, VideoTexture, CanvasTexture, MeshPhongMaterialParameters, MeshBasicMaterialParameters } from 'three';
1
+ import { MeshPhongMaterialParameters, MeshBasicMaterialParameters, Texture } from 'three';
2
2
  import { IVector3, Level } from '../Interface';
3
3
  import { BaseMesh } from '../Library';
4
4
  export declare type TextureImage = string | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement;
@@ -16,6 +16,10 @@ export interface PoiMeshOptions extends MeshBasicMaterialParameters, MeshPhongMa
16
16
  userData?: any;
17
17
  level?: Level;
18
18
  visible?: boolean;
19
+ /**
20
+ * 是否使用缓存的材质
21
+ */
22
+ cache?: boolean;
19
23
  }
20
24
  export interface CreatePoiMeshOptions extends PoiMeshOptions {
21
25
  position?: IVector3;
@@ -28,8 +32,7 @@ export interface CreatePoiMeshOptions extends PoiMeshOptions {
28
32
  * @param options
29
33
  * @returns
30
34
  */
31
- export declare function createPoiMesh(options: CreatePoiMeshOptions): BaseMesh;
32
- export declare function createTexture(image: string | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement): Texture | CanvasTexture | VideoTexture;
35
+ export declare function createPoiMesh(options: CreatePoiMeshOptions, textureCache?: Map<string, Texture>): BaseMesh;
33
36
  export interface CreatePolygonPoiMeshOptions extends PoiMeshOptions {
34
37
  points: IVector3[];
35
38
  }
@@ -38,4 +41,4 @@ export interface CreatePolygonPoiMeshOptions extends PoiMeshOptions {
38
41
  * @param options
39
42
  * @returns
40
43
  */
41
- export declare function createPolygonPoiMesh(options: CreatePolygonPoiMeshOptions): BaseMesh;
44
+ export declare function createPolygonPoiMesh(options: CreatePolygonPoiMeshOptions, textureCache?: Map<string, Texture>): BaseMesh;
@@ -1,4 +1,4 @@
1
- import { Vector3, Box2, Matrix3, Matrix4, ShapeGeometry, Box3, Sphere, Object3D } from 'three';
1
+ import { Vector3, Box2, Matrix3, Matrix4, ShapeGeometry, Box3, Sphere, Object3D, Texture, VideoTexture, CanvasTexture } from 'three';
2
2
  export declare function getPolygonGeometryInfo(points: Vector3[]): {
3
3
  geometry: ShapeGeometry;
4
4
  polygonBox: Box2;
@@ -28,3 +28,4 @@ export declare function boundingIsIntersected(target: Box3 | Sphere, obj: Object
28
28
  * 获取对象的包围合
29
29
  */
30
30
  export declare function getBoundingBox(obj: Object3D): Box3;
31
+ export declare function createTexture(image: string | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, cache?: boolean, textureCache?: Map<string, Texture>): Texture | CanvasTexture | VideoTexture;