gltf-parser-plugin 1.1.3 → 1.1.5

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/build/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Box3 } from 'three';
2
+ import { Color } from 'three';
2
3
  import { EventDispatcher } from 'three';
3
4
  import { Intersection } from 'three';
4
5
  import { Material } from 'three';
@@ -8,6 +9,8 @@ import { TilesRenderer } from '3d-tiles-renderer';
8
9
  import { Vector3 } from 'three';
9
10
  import { WebGLRenderer } from 'three';
10
11
 
12
+ export declare type ColorInput = number | string | Color;
13
+
11
14
  /**
12
15
  * Hit object feature information interface
13
16
  */
@@ -31,11 +34,8 @@ export declare class GLTFParserPlugin implements MeshHelperHost {
31
34
  private _structurePromise;
32
35
  private _modelInfo;
33
36
  private _modelInfoPromise;
34
- private _frozenOids;
35
- private _isolatedOids;
36
- private _trackedMeshes;
37
- private _meshListeners;
38
- private _isPluginRemoving;
37
+ private _interactionFilter;
38
+ private _componentColorHelper;
39
39
  oids: number[];
40
40
  private renderer;
41
41
  private splitMeshCache;
@@ -80,9 +80,6 @@ export declare class GLTFParserPlugin implements MeshHelperHost {
80
80
  * 首次调用时会自动请求
81
81
  */
82
82
  getStructureData(): Promise<StructureData | null>;
83
- private _pointInPolygon;
84
- private _segmentsIntersect;
85
- private _polygonIntersectsRect;
86
83
  /**
87
84
  * 选择包围盒范围内的构件(包含相交和包含两种情况)
88
85
  * @param box 查询用的 Box3 范围,坐标系与 structure.json 中 bbox 一致
@@ -134,58 +131,17 @@ export declare class GLTFParserPlugin implements MeshHelperHost {
134
131
  * Respects freeze and isolate filters
135
132
  */
136
133
  queryFeatureFromIntersection(hit: Intersection): FeatureInfo;
137
- private _isOidBlocked;
138
- private _trackMesh;
139
- private _untrackMesh;
140
- private _onCollectorMeshChange;
141
- private _syncCollectorMeshes;
142
- /**
143
- * 冻结指定构件,被冻结的构件不再响应任何交互和事件
144
- */
145
134
  freezeByOids(oids: number[]): void;
146
- /**
147
- * 冻结单个构件
148
- */
149
135
  freezeByOid(oid: number): void;
150
- /**
151
- * 解冻指定构件
152
- */
153
136
  unfreezeByOids(oids: number[]): void;
154
- /**
155
- * 解冻单个构件
156
- */
157
137
  unfreezeByOid(oid: number): void;
158
- /**
159
- * 解冻全部构件
160
- */
161
138
  unfreeze(): void;
162
- /**
163
- * 获取当前被冻结的 OID 数组
164
- */
165
139
  getFrozenOids(): number[];
166
- /**
167
- * 隔离指定构件,隔离模式下只有被隔离的构件才能响应交互和事件
168
- */
169
140
  isolateByOids(oids: number[]): void;
170
- /**
171
- * 往隔离集合中添加单个构件
172
- */
173
141
  isolateByOid(oid: number): void;
174
- /**
175
- * 取消隔离指定构件
176
- */
177
142
  unisolateByOids(oids: number[]): void;
178
- /**
179
- * 从隔离集合中移除单个构件
180
- */
181
143
  unisolateByOid(oid: number): void;
182
- /**
183
- * 取消全部隔离,恢复所有构件的交互能力
184
- */
185
144
  unisolate(): void;
186
- /**
187
- * 获取当前被隔离的 OID 数组
188
- */
189
145
  getIsolatedOids(): number[];
190
146
  /**
191
147
  * 内部方法:根据 oid 获取 mesh 数组
@@ -205,6 +161,30 @@ export declare class GLTFParserPlugin implements MeshHelperHost {
205
161
  * Restore the display of the corresponding mesh according to the OID array
206
162
  */
207
163
  unhideByOids(oids: number[]): void;
164
+ /**
165
+ * 根据 oid 数组设置构件颜色
166
+ * 隐藏原 mesh,将 split mesh 替换材质后加入场景(使用 tiles.group)
167
+ * @param oids 构件 OID 数组
168
+ * @param color 颜色值,支持 hex 数字、颜色字符串(如 "#ff0000")、THREE.Color 对象
169
+ */
170
+ setComponentColorByOids(oids: number[], color: ColorInput): void;
171
+ /**
172
+ * 恢复指定构件的颜色
173
+ * 从场景移除 split mesh,unhide 原 mesh
174
+ * @param oids 构件 OID 数组
175
+ */
176
+ restoreComponentColorByOids(oids: number[]): void;
177
+ /**
178
+ * 根据 oid 数组设置构件透明度
179
+ * @param oids 构件 OID 数组
180
+ * @param opacity 透明度,0-1,0 完全透明,1 完全不透明
181
+ */
182
+ setComponentOpacityByOids(oids: number[], opacity: number): void;
183
+ /**
184
+ * 恢复指定构件的透明度
185
+ * @param oids 构件 OID 数组
186
+ */
187
+ restoreComponentOpacityByOids(oids: number[]): void;
208
188
  /**
209
189
  * Restore the original materials of the mesh
210
190
  */
package/package.json CHANGED
@@ -1,47 +1,47 @@
1
- {
2
- "name": "gltf-parser-plugin",
3
- "version": "1.1.3",
4
- "description": "A plugin for parsing GLTF files",
5
- "type": "module",
6
- "main": "./build/gltf-parser-plugin.module.js",
7
- "module": "./build/gltf-parser-plugin.module.js",
8
- "types": "./build/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "import": "./build/gltf-parser-plugin.module.js",
12
- "types": "./build/index.d.ts"
13
- }
14
- },
15
- "files": [
16
- "build"
17
- ],
18
- "scripts": {
19
- "dev": "vite build --watch",
20
- "serve": "vite",
21
- "build": "tsc && vite build",
22
- "test": "vitest",
23
- "test:watch": "vitest --watch",
24
- "type-check": "tsc --noEmit",
25
- "lint": "eslint src --ext .ts,.tsx",
26
- "prepublishOnly": "pnpm run build"
27
- },
28
- "author": "maptalks",
29
- "license": "MIT",
30
- "devDependencies": {
31
- "@types/node": "^25.4.0",
32
- "@types/three": "^0.183.1",
33
- "@typescript-eslint/eslint-plugin": "^8.57.0",
34
- "@typescript-eslint/parser": "^8.57.0",
35
- "eslint": "^10.0.3",
36
- "typescript": "^5.9.3",
37
- "vite": "^7.3.1",
38
- "vite-plugin-dts": "^4.5.4",
39
- "vitest": "^4.0.18"
40
- },
41
- "dependencies": {
42
- "3d-tiles-renderer": "^0.4.22",
43
- "@maptalks/gltf-loader": "^0.124.4",
44
- "@maptalks/transcoders.draco": "^0.124.4",
45
- "three": "^0.183.2"
46
- }
47
- }
1
+ {
2
+ "name": "gltf-parser-plugin",
3
+ "version": "1.1.5",
4
+ "description": "A plugin for parsing GLTF files",
5
+ "type": "module",
6
+ "main": "./build/gltf-parser-plugin.module.js",
7
+ "module": "./build/gltf-parser-plugin.module.js",
8
+ "types": "./build/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./build/gltf-parser-plugin.module.js",
12
+ "types": "./build/index.d.ts"
13
+ }
14
+ },
15
+ "files": [
16
+ "build"
17
+ ],
18
+ "scripts": {
19
+ "dev": "vite build --watch",
20
+ "serve": "vite",
21
+ "build": "tsc && vite build",
22
+ "test": "vitest",
23
+ "test:watch": "vitest --watch",
24
+ "type-check": "tsc --noEmit",
25
+ "lint": "eslint src --ext .ts,.tsx",
26
+ "prepublishOnly": "pnpm run build"
27
+ },
28
+ "author": "maptalks",
29
+ "license": "MIT",
30
+ "devDependencies": {
31
+ "@types/node": "^25.4.0",
32
+ "@types/three": "^0.183.1",
33
+ "@typescript-eslint/eslint-plugin": "^8.57.0",
34
+ "@typescript-eslint/parser": "^8.57.0",
35
+ "eslint": "^10.0.3",
36
+ "typescript": "^5.9.3",
37
+ "vite": "^7.3.1",
38
+ "vite-plugin-dts": "^4.5.4",
39
+ "vitest": "^4.0.18"
40
+ },
41
+ "dependencies": {
42
+ "3d-tiles-renderer": "^0.4.22",
43
+ "@maptalks/gltf-loader": "^0.124.4",
44
+ "@maptalks/transcoders.draco": "^0.124.4",
45
+ "three": "^0.183.2"
46
+ }
47
+ }