soonspacejs 2.6.9 → 2.6.11

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.6.9",
3
+ "version": "2.6.11",
4
4
  "homepage": "http://www.xwbuilders.com:8800/",
5
5
  "description": "soonspacejs 2.x",
6
6
  "module": "./dist/index.esm.js",
@@ -28,5 +28,5 @@
28
28
  "peerDependencies": {
29
29
  "three": ">=0.150.1"
30
30
  },
31
- "gitHead": "e88a2bd8a1ed89d6cbf041ba88e4bb9ac8d5c047"
31
+ "gitHead": "405584a5f5ee9a5062d4ddbad58b2b91511dbe72"
32
32
  }
@@ -0,0 +1,40 @@
1
+ import { CreateCurveAnimationClipOptions, BonePathAnimationOptions, AnimationOperate, BonePathAnimationInfo as CreateBonePathAnimationResult } from '@three3d/animation';
2
+ import type { Camera, Curve, Object3D } from 'three';
3
+ import { Vector3 } from 'three';
4
+ import type { IVector3 } from '../Interface';
5
+ import { Topology } from '../Library';
6
+ import { VectorMembersToIVectors } from '@three3d/tools';
7
+ import type { SoonSpace } from '../index';
8
+ /**
9
+ * 动画的路径
10
+ */
11
+ export type AnimationPath = IVector3[] | Curve<Vector3> | Topology;
12
+ /**
13
+ * 格式化动画路径信息
14
+ * @param path
15
+ * @returns
16
+ */
17
+ export declare function formatAnimationPath(path: AnimationPath): {
18
+ curve?: Curve<Vector3> | undefined;
19
+ points?: Vector3[] | undefined;
20
+ };
21
+ export type CreatePathAnimationOptions = VectorMembersToIVectors<Omit<CreateCurveAnimationClipOptions, 'target' | 'curve' | 'points'>>;
22
+ export declare function createPathAnimation(target: Object3D, path: AnimationPath, ssp: SoonSpace, options?: CreatePathAnimationOptions): AnimationOperate | undefined;
23
+ export interface CreatePathAnimationActionForCameraOptions_Base {
24
+ /**
25
+ * 眼睛高度
26
+ */
27
+ eyeHeight?: number;
28
+ }
29
+ export type CreatePathAnimationActionForCameraOptions = CreatePathAnimationActionForCameraOptions_Base & CreatePathAnimationOptions;
30
+ export declare function createPathAnimationActionForCamera(camera: Camera, path: IVector3[] | Curve<Vector3> | Topology, ssp: SoonSpace, options?: CreatePathAnimationActionForCameraOptions): AnimationOperate | undefined;
31
+ export type CreateBonePathAnimationOptions = VectorMembersToIVectors<Omit<BonePathAnimationOptions, 'mixer' | 'model'>>;
32
+ export type BonePathAnimationInfo = Omit<CreateBonePathAnimationResult, 'action'> & {
33
+ action: AnimationOperate;
34
+ };
35
+ /**
36
+ * 创建骨骼路径动画
37
+ * @param options
38
+ * @returns
39
+ */
40
+ export declare function createBonePathAnimation(model: Object3D, path: AnimationPath, ssp: SoonSpace, options: CreateBonePathAnimationOptions): BonePathAnimationInfo;
@@ -1,4 +1,4 @@
1
- import { EventDispatcher, MOUSE, OrthographicCamera, PerspectiveCamera, TOUCH, Vector3 } from 'three';
1
+ import { EventDispatcher, OrthographicCamera, PerspectiveCamera, Vector3 } from 'three';
2
2
  import { OrbitControlsProperties } from '../Interface';
3
3
  declare class OrbitControls extends EventDispatcher implements OrbitControlsProperties {
4
4
  object: PerspectiveCamera | OrthographicCamera;
@@ -40,13 +40,13 @@ declare class OrbitControls extends EventDispatcher implements OrbitControlsProp
40
40
  BOTTOM: string;
41
41
  };
42
42
  mouseButtons: {
43
- LEFT: MOUSE;
44
- MIDDLE: MOUSE;
45
- RIGHT: MOUSE;
43
+ LEFT: 0;
44
+ MIDDLE: 1;
45
+ RIGHT: 2;
46
46
  };
47
47
  touches: {
48
- ONE: TOUCH;
49
- TWO: TOUCH;
48
+ ONE: 0 | 1;
49
+ TWO: 2 | 3;
50
50
  };
51
51
  target0: Vector3;
52
52
  position0: Vector3;
@@ -1,4 +1,4 @@
1
- import { Color } from 'three';
1
+ import { ColorRepresentation } from 'three';
2
2
  interface Interpolate {
3
3
  t: number;
4
4
  }
@@ -19,7 +19,7 @@ interface IVector3 extends IVector2 {
19
19
  type Position = IVector3;
20
20
  type Rotation = IVector3;
21
21
  type Scale = IVector3;
22
- type IColor = string | number | Color;
22
+ type IColor = ColorRepresentation;
23
23
  interface Level {
24
24
  max: number | null;
25
25
  min: number | null;
@@ -90,6 +90,10 @@ interface ViewportOptions {
90
90
  }
91
91
  interface ViewportState {
92
92
  useFreq: number;
93
+ /**
94
+ * 是否启用后处理
95
+ */
96
+ enabledPostprocessing: boolean;
93
97
  /**
94
98
  * 是否暂停 render
95
99
  */
@@ -1,4 +1,5 @@
1
- import { Mesh, Clock, Scene, PerspectiveCamera, WebGLRenderer, PMREMGenerator, Vector3, AnimationMixer, Raycaster, Intersection, Object3D, AnimationAction, AnimationClip, Texture } from 'three';
1
+ /// <reference types="stats.js" />
2
+ import { Mesh, Clock, Scene, PerspectiveCamera, WebGLRenderer, PMREMGenerator, Vector3, AnimationMixer, Raycaster, Intersection, Object3D, AnimationClip, Texture } from 'three';
2
3
  import { EffectComposer } from 'postprocessing';
3
4
  import Stats from 'three/examples/jsm/libs/stats.module.js';
4
5
  import { Sky } from 'three/examples/jsm/objects/Sky.js';
@@ -15,6 +16,7 @@ import { License } from '../License';
15
16
  import Info from './Info';
16
17
  import { ViewHelper } from './ViewHelper';
17
18
  import { WaterMark } from './WaterMark';
19
+ import { AnimationOperate } from '@three3d/animation';
18
20
  export declare const innerRenderState: {
19
21
  needsUpdate: boolean;
20
22
  };
@@ -90,7 +92,7 @@ declare class Viewport {
90
92
  /**
91
93
  ***************************** modelAnimation ***************************
92
94
  */
93
- playModelAnimation(model: Model, animation: number | AnimationClip | ModelAnimationFindFunc): AnimationAction | undefined;
95
+ playModelAnimation(model: Model, animation: number | AnimationClip | ModelAnimationFindFunc): AnimationOperate | undefined;
94
96
  stopModelAnimation(model: Model, animation: number | AnimationClip | ModelAnimationFindFunc): void;
95
97
  /**
96
98
  ***************************** render ***************************
package/types/index.d.ts CHANGED
@@ -7,10 +7,12 @@
7
7
  |_| |__/
8
8
  */
9
9
  import * as THREE from 'three';
10
- import { Object3D, Vector3, Euler, Box3, AnimationClip, AnimationAction, Light, Texture, Mesh } from 'three';
10
+ import { Object3D, Vector3, Euler, Box3, AnimationClip, Light, Texture, Mesh } from 'three';
11
+ import type { Camera } from 'three';
11
12
  import * as shared from './Shared';
12
13
  import Animation from './Animation';
13
14
  import { PathAnimation, PathAnimationOptions } from './Animation/path-animation';
15
+ import { CreatePathAnimationOptions, CreatePathAnimationActionForCameraOptions, CreateBonePathAnimationOptions, AnimationPath } from './Animation/createPathAnimation';
14
16
  import * as library from './Library';
15
17
  import { BaseObject3D, BaseObject3DInfo, Model, ModelInfo, Poi, PoiInfo, PoiNode, PoiNodeInfo, Topology, TopologyInfo, Group, GroupInfo, Canvas3D, Canvas3DInfo, PluginObject, PluginObjectInfo } from './Library';
16
18
  import Viewport from './Viewport';
@@ -29,6 +31,8 @@ export interface SoonSpaceConstructor {
29
31
  export * from 'three';
30
32
  export * from './Interface';
31
33
  export * from './tools';
34
+ import type { AnimationOperate } from '@three3d/animation';
35
+ export * from '@three3d/animation';
32
36
  export declare class SoonSpace {
33
37
  static readonly THREE: typeof THREE;
34
38
  readonly THREE: typeof THREE;
@@ -326,7 +330,7 @@ export declare class SoonSpace {
326
330
  * @param model
327
331
  * @param animation
328
332
  */
329
- playModelAnimation(model: Model, animation: number | AnimationClip | ModelAnimationFindFunc): AnimationAction | undefined;
333
+ playModelAnimation(model: Model, animation: number | AnimationClip | ModelAnimationFindFunc): AnimationOperate | undefined;
330
334
  /**
331
335
  * 停止播放模型动画
332
336
  * @param model
@@ -477,12 +481,12 @@ export declare class SoonSpace {
477
481
  * @param object
478
482
  * @param options
479
483
  */
480
- edgeShow(object: BaseObject3D | BaseObject3D[], options?: EdgeSelectOptions): Promise<void>;
484
+ edgeShow(object: Object3D | Object3D[], options?: EdgeSelectOptions): Promise<void>;
481
485
  /**
482
486
  * 取消轮廓显示模型
483
487
  * @param objects
484
488
  */
485
- unEdgeShow(objects?: BaseObject3D | BaseObject3D[]): Promise<void | void[]>;
489
+ unEdgeShow(objects?: Object3D | Object3D[]): Promise<void | void[]>;
486
490
  /**
487
491
  * 描边显示模型
488
492
  * @param object
@@ -1302,5 +1306,30 @@ export declare class SoonSpace {
1302
1306
  * @returns
1303
1307
  */
1304
1308
  createTopologyAnimation(target: Object3D, topology: Topology, options?: PathAnimationOptions): PathAnimation;
1309
+ /**
1310
+ * 创建沿路径运动的动画 action
1311
+ *
1312
+ * @param target
1313
+ * @param path
1314
+ * @param options
1315
+ * @returns 返回 AnimationOperate,它是对 AnimationAction 的扩展
1316
+ */
1317
+ createPathAnimationAction(target: Object3D, path: AnimationPath, options: CreatePathAnimationOptions): AnimationOperate | undefined;
1318
+ /**
1319
+ * 创建相机动画
1320
+ * @param path
1321
+ * @param mixer
1322
+ * @param options
1323
+ * @returns
1324
+ */
1325
+ createPathAnimationActionForCamera(path: AnimationPath, options?: CreatePathAnimationActionForCameraOptions & {
1326
+ camera?: Camera;
1327
+ }): AnimationOperate | undefined;
1328
+ /**
1329
+ * 创建骨骼路径动画
1330
+ * @param options
1331
+ * @returns
1332
+ */
1333
+ createBonePathAnimation(model: Object3D, path: AnimationPath, options: CreateBonePathAnimationOptions): import("./Animation/createPathAnimation").BonePathAnimationInfo;
1305
1334
  }
1306
1335
  export default SoonSpace;