@kimap/indoor-positioning-sdk-vue2 3.9.6 → 3.9.7
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/KimapCore.browser.js +24 -24
- package/src/KimapCore.js +32 -34
package/package.json
CHANGED
package/src/KimapCore.browser.js
CHANGED
|
@@ -340,17 +340,19 @@
|
|
|
340
340
|
this.renderer.shadowMap.enabled = true;
|
|
341
341
|
this.renderer.shadowMap.type = THREE.PCFSoftShadowMap;
|
|
342
342
|
|
|
343
|
-
// 设置输出色彩空间为sRGB
|
|
343
|
+
// 设置输出色彩空间为sRGB
|
|
344
344
|
this.renderer.outputColorSpace = THREE.SRGBColorSpace;
|
|
345
345
|
|
|
346
|
-
//
|
|
347
|
-
|
|
348
|
-
|
|
346
|
+
// 色调映射设置(优化颜色显示)
|
|
347
|
+
this.renderer.toneMapping = THREE.CineonToneMapping; // 3 = Cineon
|
|
348
|
+
this.renderer.toneMappingExposure = 1.0;
|
|
349
349
|
|
|
350
350
|
console.log('🖼️ 渲染器配置:', {
|
|
351
351
|
outputColorSpace: this.renderer.outputColorSpace,
|
|
352
352
|
shadowMapEnabled: this.renderer.shadowMap.enabled,
|
|
353
|
-
shadowMapType: this.renderer.shadowMap.type
|
|
353
|
+
shadowMapType: this.renderer.shadowMap.type,
|
|
354
|
+
toneMapping: this.renderer.toneMapping,
|
|
355
|
+
toneMappingExposure: this.renderer.toneMappingExposure
|
|
354
356
|
});
|
|
355
357
|
|
|
356
358
|
this.container.appendChild(this.renderer.domElement);
|
|
@@ -378,12 +380,12 @@
|
|
|
378
380
|
};
|
|
379
381
|
|
|
380
382
|
SceneCore.prototype.setupLights = function() {
|
|
381
|
-
//
|
|
383
|
+
// 环境光
|
|
382
384
|
var ambientLight = new THREE.AmbientLight(0xffffff, 0.6);
|
|
383
385
|
this.scene.add(ambientLight);
|
|
384
386
|
|
|
385
|
-
//
|
|
386
|
-
var directionalLight1 = new THREE.DirectionalLight(0xffffff, 0.
|
|
387
|
+
// 主光源(从上方)
|
|
388
|
+
var directionalLight1 = new THREE.DirectionalLight(0xffffff, 0.75);
|
|
387
389
|
directionalLight1.position.set(10, 20, 10);
|
|
388
390
|
directionalLight1.castShadow = true;
|
|
389
391
|
directionalLight1.shadow.camera.left = -50;
|
|
@@ -392,13 +394,13 @@
|
|
|
392
394
|
directionalLight1.shadow.camera.bottom = -50;
|
|
393
395
|
this.scene.add(directionalLight1);
|
|
394
396
|
|
|
395
|
-
//
|
|
396
|
-
var directionalLight2 = new THREE.DirectionalLight(0xffffff, 0.
|
|
397
|
+
// 辅助光源
|
|
398
|
+
var directionalLight2 = new THREE.DirectionalLight(0xffffff, 0.15);
|
|
397
399
|
directionalLight2.position.set(-10, 15, -10);
|
|
398
400
|
this.scene.add(directionalLight2);
|
|
399
401
|
|
|
400
|
-
//
|
|
401
|
-
var hemisphereLight = new THREE.HemisphereLight(0xffffff, 0x444444, 0.
|
|
402
|
+
// 半球光
|
|
403
|
+
var hemisphereLight = new THREE.HemisphereLight(0xffffff, 0x444444, 0.15);
|
|
402
404
|
this.scene.add(hemisphereLight);
|
|
403
405
|
};
|
|
404
406
|
|
|
@@ -619,21 +621,20 @@
|
|
|
619
621
|
var transparent = opacity < 1.0;
|
|
620
622
|
|
|
621
623
|
// 根据材质名称判断元素类型,设置对应的PBR参数
|
|
622
|
-
|
|
623
|
-
var
|
|
624
|
-
var metalness = 0;
|
|
624
|
+
var roughness = 0.7;
|
|
625
|
+
var metalness = 0.1;
|
|
625
626
|
|
|
626
627
|
if (child.material.name.startsWith('Area_')) {
|
|
627
|
-
roughness = 0.
|
|
628
|
-
metalness = 0;
|
|
628
|
+
roughness = 0.05; // 区域材质非常光滑
|
|
629
|
+
metalness = 0.3; // 适度金属感
|
|
629
630
|
transparent = true; // 区域支持透明
|
|
630
631
|
} else if (child.material.name.startsWith('Wall_')) {
|
|
631
|
-
roughness = 0.
|
|
632
|
-
metalness = 0;
|
|
632
|
+
roughness = 0.55; // 墙体材质
|
|
633
|
+
metalness = 0.1;
|
|
633
634
|
} else if (child.material.name.startsWith('Shape_') ||
|
|
634
635
|
child.material.name.startsWith('Stair_')) {
|
|
635
|
-
roughness = 0.
|
|
636
|
-
metalness = 0;
|
|
636
|
+
roughness = 0.7;
|
|
637
|
+
metalness = 0.3;
|
|
637
638
|
}
|
|
638
639
|
|
|
639
640
|
// 创建新的PBR材质
|
|
@@ -669,11 +670,10 @@
|
|
|
669
670
|
}
|
|
670
671
|
|
|
671
672
|
console.log('⚪ 创建默认材质 for', child.name || child.parent.name);
|
|
672
|
-
// 与3D预览保持一致:高粗糙度、低金属度
|
|
673
673
|
child.material = new THREE.MeshStandardMaterial({
|
|
674
674
|
color: meshColor,
|
|
675
|
-
roughness: 0.
|
|
676
|
-
metalness: 0,
|
|
675
|
+
roughness: 0.7,
|
|
676
|
+
metalness: 0.1,
|
|
677
677
|
side: THREE.DoubleSide
|
|
678
678
|
});
|
|
679
679
|
}
|
package/src/KimapCore.js
CHANGED
|
@@ -370,7 +370,7 @@ SceneCore.prototype.setCameraPosition = function() {
|
|
|
370
370
|
};
|
|
371
371
|
|
|
372
372
|
SceneCore.prototype.initRenderer = function() {
|
|
373
|
-
this.renderer = new THREE.WebGLRenderer({ antialias: true
|
|
373
|
+
this.renderer = new THREE.WebGLRenderer({ antialias: true });
|
|
374
374
|
this.renderer.setSize(this.container.clientWidth, this.container.clientHeight);
|
|
375
375
|
this.renderer.setPixelRatio(window.devicePixelRatio);
|
|
376
376
|
|
|
@@ -378,12 +378,12 @@ SceneCore.prototype.initRenderer = function() {
|
|
|
378
378
|
this.renderer.shadowMap.enabled = true;
|
|
379
379
|
this.renderer.shadowMap.type = THREE.PCFSoftShadowMap;
|
|
380
380
|
|
|
381
|
-
// 设置输出色彩空间为sRGB
|
|
381
|
+
// 设置输出色彩空间为sRGB
|
|
382
382
|
this.renderer.outputColorSpace = THREE.SRGBColorSpace;
|
|
383
383
|
|
|
384
|
-
//
|
|
385
|
-
|
|
386
|
-
|
|
384
|
+
// 色调映射设置(优化颜色显示)
|
|
385
|
+
this.renderer.toneMapping = THREE.CineonToneMapping; // 3 = Cineon
|
|
386
|
+
this.renderer.toneMappingExposure = 1.0;
|
|
387
387
|
|
|
388
388
|
this.container.appendChild(this.renderer.domElement);
|
|
389
389
|
};
|
|
@@ -403,12 +403,12 @@ SceneCore.prototype.initControls = function(OrbitControls) {
|
|
|
403
403
|
};
|
|
404
404
|
|
|
405
405
|
SceneCore.prototype.setupLights = function() {
|
|
406
|
-
//
|
|
406
|
+
// 环境光
|
|
407
407
|
var ambientLight = new THREE.AmbientLight(0xffffff, 0.6);
|
|
408
408
|
this.scene.add(ambientLight);
|
|
409
409
|
|
|
410
|
-
//
|
|
411
|
-
var directionalLight1 = new THREE.DirectionalLight(0xffffff, 0.
|
|
410
|
+
// 主光源(从上方)
|
|
411
|
+
var directionalLight1 = new THREE.DirectionalLight(0xffffff, 0.75);
|
|
412
412
|
directionalLight1.position.set(10, 20, 10);
|
|
413
413
|
directionalLight1.castShadow = true;
|
|
414
414
|
directionalLight1.shadow.camera.left = -50;
|
|
@@ -417,13 +417,13 @@ SceneCore.prototype.setupLights = function() {
|
|
|
417
417
|
directionalLight1.shadow.camera.bottom = -50;
|
|
418
418
|
this.scene.add(directionalLight1);
|
|
419
419
|
|
|
420
|
-
//
|
|
421
|
-
var directionalLight2 = new THREE.DirectionalLight(0xffffff, 0.
|
|
420
|
+
// 辅助光源
|
|
421
|
+
var directionalLight2 = new THREE.DirectionalLight(0xffffff, 0.15);
|
|
422
422
|
directionalLight2.position.set(-10, 15, -10);
|
|
423
423
|
this.scene.add(directionalLight2);
|
|
424
424
|
|
|
425
|
-
//
|
|
426
|
-
var hemisphereLight = new THREE.HemisphereLight(0xffffff, 0x444444, 0.
|
|
425
|
+
// 半球光
|
|
426
|
+
var hemisphereLight = new THREE.HemisphereLight(0xffffff, 0x444444, 0.15);
|
|
427
427
|
this.scene.add(hemisphereLight);
|
|
428
428
|
};
|
|
429
429
|
|
|
@@ -602,21 +602,20 @@ SceneCore.prototype.loadMap = function(OBJLoader, MTLLoader) {
|
|
|
602
602
|
var transparent = opacity < 1.0;
|
|
603
603
|
|
|
604
604
|
// 根据材质名称判断元素类型,设置对应的PBR参数
|
|
605
|
-
|
|
606
|
-
var
|
|
607
|
-
var metalness = 0;
|
|
605
|
+
var roughness = 0.7;
|
|
606
|
+
var metalness = 0.1;
|
|
608
607
|
|
|
609
608
|
if (child.material.name.startsWith('Area_')) {
|
|
610
|
-
roughness = 0.
|
|
611
|
-
metalness = 0;
|
|
609
|
+
roughness = 0.05;
|
|
610
|
+
metalness = 0.3;
|
|
612
611
|
transparent = true;
|
|
613
612
|
} else if (child.material.name.startsWith('Wall_')) {
|
|
614
|
-
roughness = 0.
|
|
615
|
-
metalness = 0;
|
|
613
|
+
roughness = 0.55;
|
|
614
|
+
metalness = 0.1;
|
|
616
615
|
} else if (child.material.name.startsWith('Shape_') ||
|
|
617
616
|
child.material.name.startsWith('Stair_')) {
|
|
618
|
-
roughness = 0.
|
|
619
|
-
metalness = 0;
|
|
617
|
+
roughness = 0.7;
|
|
618
|
+
metalness = 0.3;
|
|
620
619
|
}
|
|
621
620
|
|
|
622
621
|
// 创建新的PBR材质
|
|
@@ -642,11 +641,11 @@ SceneCore.prototype.loadMap = function(OBJLoader, MTLLoader) {
|
|
|
642
641
|
}
|
|
643
642
|
|
|
644
643
|
console.log('⚪ 创建默认材质 for', child.name || child.parent.name);
|
|
645
|
-
//
|
|
644
|
+
// 设置材质
|
|
646
645
|
child.material = new THREE.MeshStandardMaterial({
|
|
647
646
|
color: meshColor,
|
|
648
|
-
roughness: 0.
|
|
649
|
-
metalness: 0,
|
|
647
|
+
roughness: 0.7,
|
|
648
|
+
metalness: 0.1,
|
|
650
649
|
side: THREE.DoubleSide
|
|
651
650
|
});
|
|
652
651
|
}
|
|
@@ -782,18 +781,17 @@ SceneCore.prototype.loadMap = function(OBJLoader, MTLLoader) {
|
|
|
782
781
|
var opacity = child.material.opacity !== undefined ? child.material.opacity : 1.0;
|
|
783
782
|
var transparent = opacity < 1.0;
|
|
784
783
|
|
|
785
|
-
|
|
786
|
-
var
|
|
787
|
-
var metalness = 0;
|
|
784
|
+
var roughness = 0.7;
|
|
785
|
+
var metalness = 0.1;
|
|
788
786
|
|
|
789
787
|
if (child.material.name.startsWith('Area_')) {
|
|
790
|
-
roughness = 0.
|
|
791
|
-
metalness = 0;
|
|
788
|
+
roughness = 0.9;
|
|
789
|
+
metalness = 0.1;
|
|
792
790
|
transparent = true;
|
|
793
791
|
} else if (child.material.name.startsWith('Shape_') ||
|
|
794
792
|
child.material.name.startsWith('Stair_')) {
|
|
795
|
-
roughness = 0.
|
|
796
|
-
metalness = 0;
|
|
793
|
+
roughness = 0.7;
|
|
794
|
+
metalness = 0.3;
|
|
797
795
|
}
|
|
798
796
|
|
|
799
797
|
child.material = new THREE.MeshStandardMaterial({
|
|
@@ -805,11 +803,11 @@ SceneCore.prototype.loadMap = function(OBJLoader, MTLLoader) {
|
|
|
805
803
|
side: THREE.DoubleSide
|
|
806
804
|
});
|
|
807
805
|
} else {
|
|
808
|
-
//
|
|
806
|
+
// 设置默认材质
|
|
809
807
|
child.material = new THREE.MeshStandardMaterial({
|
|
810
808
|
color: 0xdddddd,
|
|
811
|
-
roughness: 0.
|
|
812
|
-
metalness: 0,
|
|
809
|
+
roughness: 0.7,
|
|
810
|
+
metalness: 0.1,
|
|
813
811
|
side: THREE.DoubleSide
|
|
814
812
|
});
|
|
815
813
|
}
|