您创建MeshPhongMaterial当纹理加载完毕。然而,在加载纹理之前,网格已经被创建。由于此大气层材料仍未定义,因此使用基本材料。
在您的装载机功能,您已经有了一个范围错误,可能会导致这样的问题:
this.loader.load('app/textures/atmospheres/earth_1.jpg', function (texture) {
this.atmosphere_material = new THREE.MeshPhongMaterial({
map: texture,
color: 10790052,
ambient: 16777215,
emissive: 1381653,
specular: 16777215,
shininess: 5000,
opacity: 0.46,
transparent: true,
wireframe: false
});
});
的this.atmosphere_material属性未设置在地球对象。在这个回调中,范围是不同的。以下是加载纹理更简单的方法:我还没有测试的代码
var Earth = function() {
this.planet = new THREE.Object3D();
this.planet_geometry = new THREE.SphereGeometry(200, 32, 32);
this.atmosphere = new THREE.Object3D();
this.atmosphere_geometry = new THREE.SphereGeometry(205, 32, 32);
this.material = new THREE.MeshPhongMaterial({
map: THREE.ImageUtils.loadTexture("app/textures/surfaces/earth.jpg"),
color: 13750737,
ambient: 13092807,
emissive: 595494,
specular: 3223857,
shininess: 25,
opacity: 1,
transparent: false,
wireframe: false,
});
this.surface = new THREE.Mesh(this.planet_geometry, this.material);
this.planet.add(this.surface);
scene.add(this.planet);
this.atmosphere_material = new THREE.MeshPhongMaterial({
map: THREE.ImageUtils.loadTexture("app/textures/atmospheres/earth_1.jpg"),
color: 10790052,
ambient: 16777215,
emissive: 1381653,
specular: 16777215,
shininess: 5000,
opacity: 0.46,
transparent: true,
wireframe: false
});
this.surface = new THREE.Mesh(this.atmosphere_geometry, this.atmosphere_material);
this.atmosphere.add(this.surface);
scene.add(this.atmosphere);
}
,但应该是正确的。
你想完成什么?你的意思是重叠的纹理,你看到的线框? –