@kimap/indoor-positioning-sdk-vue2 5.3.5 → 5.3.6
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 +1 -1
- package/src/core/KimapSDK.js +32 -7
- package/src/core/SceneCore.js +9 -11
package/package.json
CHANGED
package/src/core/KimapSDK.js
CHANGED
|
@@ -1263,7 +1263,20 @@ KimapSDK.prototype._createTechGround = function() {
|
|
|
1263
1263
|
this.techGroundGroup.visible = false; // 默认隐藏
|
|
1264
1264
|
this.core.scene.add(this.techGroundGroup);
|
|
1265
1265
|
|
|
1266
|
-
//
|
|
1266
|
+
// 创建半透明深色地面(ALL 模式背景,不遮挡模型)
|
|
1267
|
+
var groundGeometry = new THREE.PlaneGeometry(groundSize, groundSize);
|
|
1268
|
+
var groundMaterial = new THREE.MeshBasicMaterial({
|
|
1269
|
+
color: 0x1a2a3a, // 深蓝灰色,比之前稍浅以免太暗
|
|
1270
|
+
transparent: true,
|
|
1271
|
+
opacity: 0.4, // 降低透明度避免遮挡
|
|
1272
|
+
side: THREE.DoubleSide
|
|
1273
|
+
});
|
|
1274
|
+
var ground = new THREE.Mesh(groundGeometry, groundMaterial);
|
|
1275
|
+
ground.rotation.x = -Math.PI / 2;
|
|
1276
|
+
ground.position.y = -0.15;
|
|
1277
|
+
this.techGroundGroup.add(ground);
|
|
1278
|
+
|
|
1279
|
+
// 创建网格地面
|
|
1267
1280
|
var gridHelper = new THREE.GridHelper(groundSize, 50, 0x0066aa, 0x003355);
|
|
1268
1281
|
gridHelper.position.y = -0.1;
|
|
1269
1282
|
gridHelper.material.opacity = 0.3;
|
|
@@ -1947,15 +1960,21 @@ KimapSDK.prototype._loadSingleFurniture = function(furniture, serverUrl) {
|
|
|
1947
1960
|
// =====================================================
|
|
1948
1961
|
furnitureGroup.renderOrder = 3000;
|
|
1949
1962
|
|
|
1950
|
-
//
|
|
1963
|
+
// 只对透明材质关闭 depthWrite,避免不透明家具被遮挡
|
|
1951
1964
|
obj.traverse(function(child) {
|
|
1952
1965
|
if (child instanceof THREE.Mesh) {
|
|
1953
1966
|
if (Array.isArray(child.material)) {
|
|
1954
1967
|
child.material.forEach(function(mat) {
|
|
1955
|
-
|
|
1968
|
+
// 仅对透明材质关闭 depthWrite
|
|
1969
|
+
if (mat.transparent || mat.opacity < 1) {
|
|
1970
|
+
mat.depthWrite = false;
|
|
1971
|
+
}
|
|
1956
1972
|
});
|
|
1957
1973
|
} else if (child.material) {
|
|
1958
|
-
|
|
1974
|
+
// 仅对透明材质关闭 depthWrite
|
|
1975
|
+
if (child.material.transparent || child.material.opacity < 1) {
|
|
1976
|
+
child.material.depthWrite = false;
|
|
1977
|
+
}
|
|
1959
1978
|
}
|
|
1960
1979
|
}
|
|
1961
1980
|
});
|
|
@@ -2002,15 +2021,21 @@ KimapSDK.prototype._loadSingleFurniture = function(furniture, serverUrl) {
|
|
|
2002
2021
|
// 应用Y轴微小偏移
|
|
2003
2022
|
obj.position.y += totalYOffset;
|
|
2004
2023
|
|
|
2005
|
-
//
|
|
2024
|
+
// 只对透明材质关闭 depthWrite,避免不透明家具被遮挡
|
|
2006
2025
|
obj.traverse(function(child) {
|
|
2007
2026
|
if (child instanceof THREE.Mesh) {
|
|
2008
2027
|
if (Array.isArray(child.material)) {
|
|
2009
2028
|
child.material.forEach(function(mat) {
|
|
2010
|
-
|
|
2029
|
+
// 仅对透明材质关闭 depthWrite
|
|
2030
|
+
if (mat.transparent || mat.opacity < 1) {
|
|
2031
|
+
mat.depthWrite = false;
|
|
2032
|
+
}
|
|
2011
2033
|
});
|
|
2012
2034
|
} else if (child.material) {
|
|
2013
|
-
|
|
2035
|
+
// 仅对透明材质关闭 depthWrite
|
|
2036
|
+
if (child.material.transparent || child.material.opacity < 1) {
|
|
2037
|
+
child.material.depthWrite = false;
|
|
2038
|
+
}
|
|
2014
2039
|
}
|
|
2015
2040
|
}
|
|
2016
2041
|
});
|
package/src/core/SceneCore.js
CHANGED
|
@@ -180,11 +180,11 @@ SceneCore.prototype.initControls = function(OrbitControls) {
|
|
|
180
180
|
*/
|
|
181
181
|
SceneCore.prototype.setupLights = function() {
|
|
182
182
|
// 环境光
|
|
183
|
-
var ambientLight = new THREE.AmbientLight(0xffffff, 0.
|
|
183
|
+
var ambientLight = new THREE.AmbientLight(0xffffff, 0.6);
|
|
184
184
|
this.scene.add(ambientLight);
|
|
185
|
-
|
|
185
|
+
|
|
186
186
|
// 主光源(从上方)
|
|
187
|
-
var directionalLight1 = new THREE.DirectionalLight(0xffffff, 0.
|
|
187
|
+
var directionalLight1 = new THREE.DirectionalLight(0xffffff, 0.8);
|
|
188
188
|
directionalLight1.position.set(10, 20, 10);
|
|
189
189
|
directionalLight1.castShadow = true;
|
|
190
190
|
directionalLight1.shadow.camera.left = -50;
|
|
@@ -192,14 +192,14 @@ SceneCore.prototype.setupLights = function() {
|
|
|
192
192
|
directionalLight1.shadow.camera.top = 50;
|
|
193
193
|
directionalLight1.shadow.camera.bottom = -50;
|
|
194
194
|
this.scene.add(directionalLight1);
|
|
195
|
-
|
|
195
|
+
|
|
196
196
|
// 辅助光源
|
|
197
|
-
var directionalLight2 = new THREE.DirectionalLight(0xffffff, 0);
|
|
197
|
+
var directionalLight2 = new THREE.DirectionalLight(0xffffff, 0.3);
|
|
198
198
|
directionalLight2.position.set(-10, 15, -10);
|
|
199
199
|
this.scene.add(directionalLight2);
|
|
200
|
-
|
|
200
|
+
|
|
201
201
|
// 半球光
|
|
202
|
-
var hemisphereLight = new THREE.HemisphereLight(0xffffff, 0x444444, 0.
|
|
202
|
+
var hemisphereLight = new THREE.HemisphereLight(0xffffff, 0x444444, 0.4);
|
|
203
203
|
this.scene.add(hemisphereLight);
|
|
204
204
|
};
|
|
205
205
|
|
|
@@ -967,10 +967,8 @@ SceneCore.prototype._processMaterial = function(child, materials, colorMap) {
|
|
|
967
967
|
depthWrite = opacity >= 0.8;
|
|
968
968
|
}
|
|
969
969
|
}
|
|
970
|
-
//
|
|
971
|
-
|
|
972
|
-
color.lerp(new THREE.Color(0xffffff), 0.3);
|
|
973
|
-
finalColor = color.getHex();
|
|
970
|
+
// 直接使用原始颜色,不做混白处理
|
|
971
|
+
finalColor = mtlColor;
|
|
974
972
|
}
|
|
975
973
|
|
|
976
974
|
child.material = new THREE.MeshStandardMaterial({
|