This commit is contained in:
@@ -5,8 +5,7 @@
|
|||||||
|
|
||||||
<!-- 首页脚本 -->
|
<!-- 首页脚本 -->
|
||||||
<script src="/web/BlackFruit-web/js/index.js"></script>
|
<script src="/web/BlackFruit-web/js/index.js"></script>
|
||||||
<!-- 3D 地球依赖:Three.js 和 three-globe(使用 CDN 版本方便预览效果) -->
|
<!-- 3D 地球依赖:three-globe(Three.js 由业务系统全局引入,避免多份 THREE 冲突) -->
|
||||||
<script src="https://unpkg.com/three@0.155.0/build/three.min.js"></script>
|
|
||||||
<script src="https://unpkg.com/three-globe@2.45.0/dist/three-globe.min.js"></script>
|
<script src="https://unpkg.com/three-globe@2.45.0/dist/three-globe.min.js"></script>
|
||||||
<!-- 3D 地球效果脚本(基于 three-globe) -->
|
<!-- 3D 地球效果脚本(基于 three-globe) -->
|
||||||
<script src="/web/BlackFruit-web/js/globe.js"></script>
|
<script src="/web/BlackFruit-web/js/globe.js"></script>
|
||||||
|
|||||||
27
js/globe.js
27
js/globe.js
@@ -75,9 +75,8 @@
|
|||||||
waitForGlobeReady: true,
|
waitForGlobeReady: true,
|
||||||
animateIn: true,
|
animateIn: true,
|
||||||
})
|
})
|
||||||
// 不使用外部贴图,改用自定义材质,避免贴图加载或权限问题导致地球不可见
|
// 显示球体本身和大气层
|
||||||
.globeImageUrl(null)
|
.showGlobe(true)
|
||||||
.bumpImageUrl(null)
|
|
||||||
.showAtmosphere(true)
|
.showAtmosphere(true)
|
||||||
.atmosphereColor("#2b9fff")
|
.atmosphereColor("#2b9fff")
|
||||||
.atmosphereAltitude(0.18)
|
.atmosphereAltitude(0.18)
|
||||||
@@ -103,19 +102,17 @@
|
|||||||
|
|
||||||
scene.add(globe);
|
scene.add(globe);
|
||||||
|
|
||||||
// 放大地球整体,让主体更突出
|
// 替换地球材质,使用自定义 MeshPhongMaterial,避免贴图导致的透明问题
|
||||||
globe.scale.set(1.4, 1.4, 1.4);
|
|
||||||
|
|
||||||
// 自定义地球材质,使用渐变蓝色球体,避免依赖贴图
|
|
||||||
try {
|
try {
|
||||||
var globeMat = globe.globeMaterial && globe.globeMaterial();
|
var baseMaterial = new THREE.MeshPhongMaterial({
|
||||||
if (globeMat) {
|
color: new THREE.Color("#163a5f"), // 基础色:深蓝
|
||||||
globeMat.color = new THREE.Color("#163a5f"); // 基础色
|
emissive: new THREE.Color("#040915"), // 自发光:微亮
|
||||||
globeMat.emissive = new THREE.Color("#061727"); // 自发光
|
specular: new THREE.Color("#3aaefc"), // 高光:亮蓝
|
||||||
globeMat.specular = new THREE.Color("#3aaefc"); // 高光
|
shininess: 40,
|
||||||
globeMat.shininess = 40;
|
transparent: false,
|
||||||
globeMat.needsUpdate = true;
|
opacity: 1,
|
||||||
}
|
});
|
||||||
|
globe.globeMaterial(baseMaterial);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn("[Globe] failed to tweak globe material:", e);
|
console.warn("[Globe] failed to tweak globe material:", e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user