@kimap/indoor-positioning-sdk-vue2 5.4.7 → 5.4.9

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": "@kimap/indoor-positioning-sdk-vue2",
3
- "version": "5.4.7",
3
+ "version": "5.4.9",
4
4
  "description": "Vue2自包含室内定位SDK - 完全兼容Webpack3+Babel6 | Vue2 Self-Contained Indoor Positioning SDK",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -914,12 +914,13 @@ KimapSDK.prototype._zoomToShowAllFloors = function() {
914
914
  box.getSize(size);
915
915
 
916
916
  var maxSize = Math.max(size.x, size.z);
917
- var distance = maxSize * 2;
917
+ var distance = maxSize * 1.2;
918
918
 
919
- // 计算目标位置
919
+ // 计算目标位置 - 从侧面-45度角看过去,镜头拉近
920
+ // X负方向偏移,Z方向也偏移,形成-45度角
920
921
  var targetPosition = new THREE.Vector3(
921
- center.x,
922
- center.y + distance * 1.5,
922
+ center.x - distance,
923
+ center.y + distance * 0.6,
923
924
  center.z + distance
924
925
  );
925
926
 
@@ -1198,6 +1199,8 @@ KimapSDK.prototype._createFallbackBuilding = function(x, z) {
1198
1199
 
1199
1200
  var buildingGroup = new THREE.Group();
1200
1201
  buildingGroup.position.set(x, 0, z);
1202
+ buildingGroup.castShadow = false;
1203
+ buildingGroup.receiveShadow = false;
1201
1204
 
1202
1205
  // 主楼体 - 淡蓝色半透明
1203
1206
  var geometry = new THREE.BoxGeometry(width, height, depth);
@@ -1211,11 +1214,15 @@ KimapSDK.prototype._createFallbackBuilding = function(x, z) {
1211
1214
  transparent: true,
1212
1215
  opacity: 0.7,
1213
1216
  emissive: new THREE.Color(0x1e3d5c),
1214
- emissiveIntensity: 0.3
1217
+ emissiveIntensity: 0.3,
1218
+ castShadow: false,
1219
+ receiveShadow: false
1215
1220
  });
1216
1221
 
1217
1222
  var building = new THREE.Mesh(geometry, material);
1218
1223
  building.position.y = height / 2;
1224
+ building.castShadow = false;
1225
+ building.receiveShadow = false;
1219
1226
  buildingGroup.add(building);
1220
1227
 
1221
1228
  // 添加窗户细节(较亮)
@@ -1310,6 +1317,8 @@ KimapSDK.prototype._createTechGround = function() {
1310
1317
  this.techGroundGroup = new THREE.Group();
1311
1318
  this.techGroundGroup.name = 'techGround';
1312
1319
  this.techGroundGroup.visible = false; // 默认隐藏
1320
+ this.techGroundGroup.castShadow = false;
1321
+ this.techGroundGroup.receiveShadow = false;
1313
1322
  this.core.scene.add(this.techGroundGroup);
1314
1323
 
1315
1324
  // 创建网格地面
@@ -1317,18 +1326,23 @@ KimapSDK.prototype._createTechGround = function() {
1317
1326
  gridHelper.position.y = -0.1;
1318
1327
  gridHelper.material.opacity = 0.3;
1319
1328
  gridHelper.material.transparent = true;
1329
+ gridHelper.castShadow = false;
1330
+ gridHelper.receiveShadow = false;
1320
1331
  this.techGroundGroup.add(gridHelper);
1321
1332
 
1322
- // 创建地面平面
1333
+ // 创建地面平面 - 降低透明度,不遮挡光线
1323
1334
  var groundGeometry = new THREE.PlaneGeometry(groundSize, groundSize);
1324
1335
  var groundMaterial = new THREE.MeshBasicMaterial({
1325
1336
  color: 0x0a1628,
1326
1337
  transparent: true,
1327
- opacity: 0.8
1338
+ opacity: 0.4,
1339
+ depthWrite: false
1328
1340
  });
1329
1341
  var ground = new THREE.Mesh(groundGeometry, groundMaterial);
1330
1342
  ground.rotation.x = -Math.PI / 2;
1331
1343
  ground.position.y = -0.2;
1344
+ ground.castShadow = false;
1345
+ ground.receiveShadow = false;
1332
1346
  this.techGroundGroup.add(ground);
1333
1347
  };
1334
1348
 
@@ -29,6 +29,7 @@ var extractColorsFromOBJ = parsers.extractColorsFromOBJ;
29
29
  var extractTextElementsFromOBJ = parsers.extractTextElementsFromOBJ;
30
30
  var extractWallOpacityFromOBJ = parsers.extractWallOpacityFromOBJ;
31
31
  var extractShapeOpacityFromOBJ = parsers.extractShapeOpacityFromOBJ;
32
+ var extractAreaOpacityFromOBJ = parsers.extractAreaOpacityFromOBJ;
32
33
  var extractCalibrationBoundaryAreaIdsFromOBJ = parsers.extractCalibrationBoundaryAreaIdsFromOBJ;
33
34
 
34
35
  /**
@@ -182,27 +183,23 @@ SceneCore.prototype.initControls = function(OrbitControls) {
182
183
  * 设置灯光
183
184
  */
184
185
  SceneCore.prototype.setupLights = function() {
185
- // 环境光
186
- var ambientLight = new THREE.AmbientLight(0xffffff, 0.25);
186
+ // 环境光 - 提高亮度
187
+ var ambientLight = new THREE.AmbientLight(0xffffff, 0.8);
187
188
  this.scene.add(ambientLight);
188
-
189
- // 主光源(从上方)
190
- var directionalLight1 = new THREE.DirectionalLight(0xffffff, 0.05);
189
+
190
+ // 主光源(从上方)- 提高亮度
191
+ var directionalLight1 = new THREE.DirectionalLight(0xffffff, 0.6);
191
192
  directionalLight1.position.set(10, 20, 10);
192
- directionalLight1.castShadow = true;
193
- directionalLight1.shadow.camera.left = -50;
194
- directionalLight1.shadow.camera.right = 50;
195
- directionalLight1.shadow.camera.top = 50;
196
- directionalLight1.shadow.camera.bottom = -50;
193
+ directionalLight1.castShadow = false;
197
194
  this.scene.add(directionalLight1);
198
-
199
- // 辅助光源
200
- var directionalLight2 = new THREE.DirectionalLight(0xffffff, 0);
195
+
196
+ // 辅助光源 - 提高亮度
197
+ var directionalLight2 = new THREE.DirectionalLight(0xffffff, 0.4);
201
198
  directionalLight2.position.set(-10, 15, -10);
202
199
  this.scene.add(directionalLight2);
203
-
204
- // 半球光
205
- var hemisphereLight = new THREE.HemisphereLight(0xffffff, 0x444444, 0.3);
200
+
201
+ // 半球光 - 提高亮度
202
+ var hemisphereLight = new THREE.HemisphereLight(0xffffff, 0x444444, 0.5);
206
203
  this.scene.add(hemisphereLight);
207
204
  };
208
205
 
@@ -452,7 +449,13 @@ SceneCore.prototype._loadKimapFile = function(kimapUrl, themeUrl, objLoader, mtl
452
449
  if (shapeOpacity && Object.keys(shapeOpacity).length > 0) {
453
450
  self._shapeOpacity = shapeOpacity;
454
451
  }
455
-
452
+
453
+ // 提取区域透明度信息
454
+ var areaOpacity = extractAreaOpacityFromOBJ(objContent);
455
+ if (areaOpacity && Object.keys(areaOpacity).length > 0) {
456
+ self._areaOpacity = areaOpacity;
457
+ }
458
+
456
459
  // 解析OBJ内容
457
460
  var object = objLoader.parse(objContent);
458
461
 
@@ -621,6 +624,11 @@ SceneCore.prototype._loadKimapFileToGroup = function(kimapUrl, themeUrl, objLoad
621
624
  if (shapeOpacity && Object.keys(shapeOpacity).length > 0) {
622
625
  self._shapeOpacity = shapeOpacity;
623
626
  }
627
+
628
+ var areaOpacity = extractAreaOpacityFromOBJ(objContent);
629
+ if (areaOpacity && Object.keys(areaOpacity).length > 0) {
630
+ self._areaOpacity = areaOpacity;
631
+ }
624
632
  }
625
633
 
626
634
  var object = objLoader.parse(objContent);
@@ -1146,11 +1154,21 @@ SceneCore.prototype._processMaterial = function(child, materials, colorMap) {
1146
1154
  // 与主应用 three-helper.ts 保持一致
1147
1155
  // =====================================================
1148
1156
  var depthWrite = true;
1149
-
1157
+ var emissiveEnabled = false;
1158
+ var emissiveColor = 0x000000;
1159
+ var emissiveIntensity = 0;
1160
+
1150
1161
  if (child.material.name.startsWith('Area_')) {
1151
1162
  roughness = 0.5;
1152
1163
  metalness = 0.2;
1153
1164
  transparent = true;
1165
+ // 强制设置区域透明度为0.3
1166
+ opacity = 0.3;
1167
+ transparent = opacity < 1.0;
1168
+ // 添加轻微emissive提亮区域颜色
1169
+ emissiveEnabled = true;
1170
+ emissiveColor = mtlColor;
1171
+ emissiveIntensity = 0.2;
1154
1172
  // 区域通常是高透明度的,关闭depthWrite避免与3D家具的深度冲突
1155
1173
  depthWrite = false;
1156
1174
  } else if (child.material.name.startsWith('Wall_')) {
@@ -1196,6 +1214,8 @@ SceneCore.prototype._processMaterial = function(child, materials, colorMap) {
1196
1214
  transparent: transparent,
1197
1215
  roughness: roughness,
1198
1216
  metalness: metalness,
1217
+ emissive: emissiveEnabled ? new THREE.Color(emissiveColor) : new THREE.Color(0x000000),
1218
+ emissiveIntensity: emissiveEnabled ? emissiveIntensity : 0,
1199
1219
  side: THREE.DoubleSide,
1200
1220
  depthWrite: depthWrite // 高透明度时关闭depthWrite避免频闪
1201
1221
  });
@@ -242,6 +242,36 @@ function extractShapeOpacityFromOBJ(objContent) {
242
242
  return shapeOpacity;
243
243
  }
244
244
 
245
+ /**
246
+ * 从OBJ内容中提取区域透明度信息
247
+ * 格式: # AREA_OPACITY 0.9
248
+ */
249
+ function extractAreaOpacityFromOBJ(objContent) {
250
+ var areaOpacity = {};
251
+ var lines = objContent.split('\n');
252
+ var currentAreaId = null;
253
+
254
+ for (var i = 0; i < lines.length; i++) {
255
+ var line = lines[i].trim();
256
+
257
+ if (line.indexOf('o Area_') === 0) {
258
+ // 提取区域ID(格式:Area_<id>)
259
+ var match = line.match(/Area_(.+)/);
260
+ if (match) {
261
+ currentAreaId = match[1];
262
+ }
263
+ } else if (currentAreaId && line.indexOf('# AREA_OPACITY') === 0) {
264
+ var opacity = parseFloat(line.split(' ')[2]);
265
+ if (!areaOpacity[currentAreaId]) {
266
+ areaOpacity[currentAreaId] = {};
267
+ }
268
+ areaOpacity[currentAreaId].opacity = opacity;
269
+ }
270
+ }
271
+
272
+ return areaOpacity;
273
+ }
274
+
245
275
  /**
246
276
  * 从 OBJ 中提取「真实世界尺寸校准边界」区域 ID(与绘制端 objExporter 中 # KIMAP_AREA_CALIBRATION_BOUNDARY 对应)
247
277
  * 仅此类区域不应显示;普通 Area_ 地面应保留。
@@ -273,5 +303,6 @@ module.exports = {
273
303
  extractTextElementsFromOBJ: extractTextElementsFromOBJ,
274
304
  extractWallOpacityFromOBJ: extractWallOpacityFromOBJ,
275
305
  extractShapeOpacityFromOBJ: extractShapeOpacityFromOBJ,
306
+ extractAreaOpacityFromOBJ: extractAreaOpacityFromOBJ,
276
307
  extractCalibrationBoundaryAreaIdsFromOBJ: extractCalibrationBoundaryAreaIdsFromOBJ
277
308
  };