soonspacejs 2.5.28 → 2.5.29

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.28",
3
+ "version": "2.5.29",
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": "96bd42ee5258c343c59f1259edc734b4c3ac9007"
29
+ "gitHead": "4fa46d1ba47e974dc02e97db2712c243187cd3d0"
30
30
  }
@@ -106,16 +106,15 @@ interface IntersectsOptions {
106
106
  }
107
107
  export interface BloomOptions {
108
108
  enabled?: boolean;
109
- strength?: number;
110
109
  radius?: number;
110
+ intensity?: number;
111
111
  threshold?: number;
112
- }
113
- export interface SobelOptions {
114
- enabled?: boolean;
112
+ smoothing?: number;
113
+ selection?: Object3D[];
114
+ opacity?: number;
115
115
  }
116
116
  export interface SSAOOptions {
117
117
  enabled?: boolean;
118
- distanceScaling?: boolean;
119
118
  depthAwareUpsampling?: boolean;
120
119
  samples?: number;
121
120
  rings?: number;
@@ -136,6 +135,33 @@ export interface SSAOOptions {
136
135
  color?: IColor;
137
136
  resolutionScale?: number;
138
137
  }
138
+ export interface SSROptions {
139
+ enabled?: boolean;
140
+ intensity?: number;
141
+ exponent?: number;
142
+ distance?: number;
143
+ fade?: number;
144
+ roughnessFade?: number;
145
+ thickness?: number;
146
+ ior?: number;
147
+ maxRoughness?: number;
148
+ maxDepthDifference?: number;
149
+ blend?: number;
150
+ correction?: number;
151
+ correctionRadius?: number;
152
+ blur?: number;
153
+ blurKernel?: number;
154
+ blurSharpness?: number;
155
+ jitter?: number;
156
+ jitterRoughness?: number;
157
+ steps?: number;
158
+ refineSteps?: number;
159
+ missedRays?: boolean;
160
+ useNormalMap?: boolean;
161
+ useRoughnessMap?: boolean;
162
+ resolutionScale?: number;
163
+ velocityResolutionScale?: number;
164
+ }
139
165
  export interface ToneMappingOptions {
140
166
  type?: 'None' | 'Linear' | 'Reinhard' | 'Cineon' | 'ACESFilmic';
141
167
  exposure?: number;
@@ -11,11 +11,12 @@ declare class EffectManager {
11
11
  static CONSTANTS: {
12
12
  renderPass: string;
13
13
  normalPass: string;
14
- depthDownsamplingPass: string;
15
14
  effectPass: string;
16
15
  smaaEffect: string;
17
16
  ssaoEffect: string;
18
17
  outlineEffect: string;
18
+ ssrEffect: string;
19
+ bloomEffect: string;
19
20
  };
20
21
  effectComposer: EffectComposer;
21
22
  passesMap: Map<string, Pass>;
@@ -35,11 +36,12 @@ declare class EffectManager {
35
36
  private _initPasses;
36
37
  private _initRenderPass;
37
38
  private _initNormalPass;
38
- private _initDownSamplingPass;
39
39
  private _initEffectPass;
40
40
  private _initEffects;
41
41
  private _initSMAAEffect;
42
- private _initSSAOEffect;
42
+ private _initSSREffect;
43
+ private _initBloomEffect;
43
44
  private _initOutlineEffect;
45
+ private _initSSAOEffect;
44
46
  }
45
47
  export default EffectManager;
@@ -9,7 +9,7 @@ import CameraManager from './CameraManager';
9
9
  import EffectManager from './EffectManager';
10
10
  import { Controls } from '../Controls';
11
11
  import { Model } from '../Library';
12
- import { IColorSpace, SkyOptions, IColor, OffsetPoint, SceneEventType, Position, ViewportOptions, ViewportState, ModelAnimationFindFunc, SignalsState, ToneMappingOptions, SSAOOptions, IntersectsOptions } from '../Interface';
12
+ import { IColorSpace, SkyOptions, IColor, OffsetPoint, SceneEventType, Position, ViewportOptions, ViewportState, ModelAnimationFindFunc, SignalsState, ToneMappingOptions, SSAOOptions, SSROptions, BloomOptions, IntersectsOptions } from '../Interface';
13
13
  import Info from './Info';
14
14
  import { ViewHelper } from './ViewHelper';
15
15
  export declare const innerRenderState: {
@@ -57,8 +57,8 @@ declare class Viewport {
57
57
  /**
58
58
  ***************************** post-processing ***************************
59
59
  */
60
- setSobel(): void;
61
- setBloom(): void;
60
+ setSSR(options?: SSROptions): void;
61
+ setBloom(options?: BloomOptions): void;
62
62
  setSSAO(options?: SSAOOptions): void;
63
63
  /**
64
64
  ***************************** renderer ***************************
package/types/index.d.ts CHANGED
@@ -7,6 +7,7 @@
7
7
  |_| |__/
8
8
  */
9
9
  import { TransformControls } from 'three/examples/jsm/controls/TransformControls.js';
10
+ import { Reflector } from 'three/examples/jsm/objects/Reflector.js';
10
11
  import { Object3D, Vector3, Euler, Box3, AnimationClip, AnimationAction, Light, AmbientLight, DirectionalLight, HemisphereLight, SpotLight, PointLight, RectAreaLight } from 'three';
11
12
  import * as shared from './Shared';
12
13
  import Animation from './Animation';
@@ -14,7 +15,7 @@ import * as library from './Library';
14
15
  import { BaseObject3D, BaseObject3DInfo, Model, ModelInfo, Poi, PoiInfo, PoiNode, PoiNodeInfo, Topology, TopologyInfo, Group, GroupInfo, Canvas3D, Canvas3DInfo, PluginObject, PluginObjectInfo } from './Library';
15
16
  import Viewport from './Viewport';
16
17
  import Manager from './Manager';
17
- import { ViewportOptions, SceneGlobalEvents, PluginsConstructor, IColor, Position, Rotation, OffsetPoint, AnimationOptions, ModelAnimationFindFunc, TopologyNodeInfo, CameraViewpointData, CameraTargetViewData, FlyToViewpoint, FlyToObjOptions, SurroundOptions, LabelOptions, EdgeSelectOptions, StrokeSelectOptions, OpacitySelectOptions, HighlightSelectOptions, EmissiveSelectOptions, FogOptions, UserDataPropertyFindFunc, AmbientLightOptions, DirectionalLightOptions, HemisphereLightOptions, SpotLightOptions, PointLightOptions, CloneModelInfo, ClonePoiInfo, ShortestPathInfo, ShortestPathByMultipleStartPoints, ShortestPathByMultipleEndPoints, TopologyInfoForGml, GridHelperOptions, AxesHelperOptions, BoxHelperOptions, PlaneHelperOptions, GroundHelperOptions, DirectionalLightHelperOptions, HemisphereLightHelperOptions, SpotLightHelperOptions, PointLightHelperOptions, SignalsState, ControlsOptions, RectAreaLightOptions, RectAreaLightHelperOptions, SkyOptions, IColorSpace, ToneMappingOptions, SSAOOptions } from './Interface';
18
+ import { ViewportOptions, SceneGlobalEvents, PluginsConstructor, IColor, Position, Rotation, OffsetPoint, AnimationOptions, ModelAnimationFindFunc, TopologyNodeInfo, CameraViewpointData, CameraTargetViewData, FlyToViewpoint, FlyToObjOptions, SurroundOptions, LabelOptions, EdgeSelectOptions, StrokeSelectOptions, OpacitySelectOptions, HighlightSelectOptions, EmissiveSelectOptions, FogOptions, UserDataPropertyFindFunc, AmbientLightOptions, DirectionalLightOptions, HemisphereLightOptions, SpotLightOptions, PointLightOptions, CloneModelInfo, ClonePoiInfo, ShortestPathInfo, ShortestPathByMultipleStartPoints, ShortestPathByMultipleEndPoints, TopologyInfoForGml, GridHelperOptions, AxesHelperOptions, BoxHelperOptions, PlaneHelperOptions, GroundHelperOptions, DirectionalLightHelperOptions, HemisphereLightHelperOptions, SpotLightHelperOptions, PointLightHelperOptions, SignalsState, ControlsOptions, RectAreaLightOptions, RectAreaLightHelperOptions, SkyOptions, IColorSpace, ToneMappingOptions, SSROptions, SSAOOptions, BloomOptions } from './Interface';
18
19
  export declare type InitOptions = ViewportOptions;
19
20
  export declare type InitEvents = SceneGlobalEvents;
20
21
  export interface SoonSpaceConstructor {
@@ -25,7 +26,9 @@ export interface SoonSpaceConstructor {
25
26
  import * as THREE from 'three';
26
27
  export * from 'three';
27
28
  export * from './Interface';
28
- import { BoxSpace, FindObjectsNearPosition, FindNearbyObjects } from './tools/index';
29
+ import { BoxSpace, FindObjectsNearPosition, FindNearbyObjects } from './tools/find-objects';
30
+ import { CreatePoiMeshOptions, CreatePolygonPoiMeshOptions } from './tools/poi-mesh';
31
+ export * from './tools/units';
29
32
  declare global {
30
33
  interface Window {
31
34
  THREE: typeof THREE;
@@ -196,6 +199,7 @@ export declare class SoonSpace {
196
199
  readonly utils: typeof shared;
197
200
  readonly THREE_PLUGINS: {
198
201
  TransformControls: typeof TransformControls;
202
+ Reflector: typeof Reflector;
199
203
  };
200
204
  readonly version: string;
201
205
  readonly options: InitOptions;
@@ -265,15 +269,19 @@ export declare class SoonSpace {
265
269
  /******/
266
270
  /******/
267
271
  /**
268
- * 设置边缘检测
272
+ * 设置空间反射
269
273
  * @param options
270
274
  */
271
- setSobel(): void;
275
+ setSSR(options?: SSROptions): void;
272
276
  /**
273
277
  * 设置泛光
274
278
  * @param bloom
275
279
  */
276
- setBloom(): void;
280
+ setBloom(options?: BloomOptions): void;
281
+ /**
282
+ * 环境光遮蔽
283
+ * @param options
284
+ */
277
285
  setSSAO(options?: SSAOOptions): void;
278
286
  /**
279
287
  * 设置场景的颜色空间
@@ -943,6 +951,18 @@ export declare class SoonSpace {
943
951
  * 隐藏所有 PoiNode
944
952
  */
945
953
  hideAllPoiNode(): void;
954
+ /**
955
+ * 创建 poi mesh
956
+ * @param options
957
+ * @returns
958
+ */
959
+ createPoiMesh(options: CreatePoiMeshOptions): library.BaseMesh;
960
+ /**
961
+ * 创建多边形 poi mesh
962
+ * @param options
963
+ * @returns
964
+ */
965
+ createPolygonPoiMesh(options: CreatePolygonPoiMeshOptions): library.BaseMesh;
946
966
  /******/
947
967
  /******/
948
968
  /******* Canvas3D methods */
File without changes
@@ -0,0 +1,41 @@
1
+ import { Texture, VideoTexture, CanvasTexture, MeshPhongMaterialParameters, MeshBasicMaterialParameters } from 'three';
2
+ import { IVector3, Level } from '../Interface';
3
+ import { BaseMesh } from '../Library';
4
+ export declare type TextureImage = string | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement;
5
+ export interface PoiMeshOptions extends MeshBasicMaterialParameters, MeshPhongMaterialParameters {
6
+ /**
7
+ * 图片的url 或者是 HTMLImageElement | HTMLCanvasElement | HTMLVideoElement
8
+ */
9
+ image: TextureImage;
10
+ /**
11
+ * 是否需要有灯光才能显示
12
+ */
13
+ needLight?: boolean;
14
+ id: string | number;
15
+ name?: string;
16
+ userData?: any;
17
+ level?: Level;
18
+ visible?: boolean;
19
+ }
20
+ export interface CreatePoiMeshOptions extends PoiMeshOptions {
21
+ position?: IVector3;
22
+ rotation?: IVector3;
23
+ width?: number;
24
+ height?: number;
25
+ }
26
+ /**
27
+ * 创建 poi mesh
28
+ * @param options
29
+ * @returns
30
+ */
31
+ export declare function createPoiMesh(options: CreatePoiMeshOptions): BaseMesh;
32
+ export declare function createTexture(image: string | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement): Texture | CanvasTexture | VideoTexture;
33
+ export interface CreatePolygonPoiMeshOptions extends PoiMeshOptions {
34
+ points: IVector3[];
35
+ }
36
+ /**
37
+ * 创建多边形 poi mesh
38
+ * @param options
39
+ * @returns
40
+ */
41
+ export declare function createPolygonPoiMesh(options: CreatePolygonPoiMeshOptions): BaseMesh;
@@ -0,0 +1,22 @@
1
+ import { Vector3, Box2, Matrix3, Matrix4, ShapeGeometry } from 'three';
2
+ export declare function getPolygonGeometryInfo(points: Vector3[]): {
3
+ geometry: ShapeGeometry;
4
+ polygonBox: Box2;
5
+ modelMatrix: Matrix4;
6
+ planeMatrix: Matrix4;
7
+ projectionMatrix: Matrix4;
8
+ position: Vector3;
9
+ };
10
+ /**
11
+ * 创建平面投影矩阵
12
+ * @param points
13
+ */
14
+ export declare function createPlaneMatrix(points: Vector3[]): Matrix3;
15
+ /**
16
+ * 创建 uv 变换矩阵
17
+ * @remarks
18
+ * 需要对热力图数据进行y值翻转
19
+ * @param points
20
+ * @returns
21
+ */
22
+ export declare function createUVMatrix(box: Box2): Matrix3;