텍스처 로딩이 완료되면 당신은 MeshPhongMaterial를 작성,하지만 난 ..
내가 좋은 답변에 희망
를 작동하게하기 위해 코드를 편집 할 수있는 방법을 찾을 수 없습니다. 그러나 텍스처가로드되기 전에 메쉬가 이미 생성되었습니다. this.atmosphere_material은 아직 정의되지 않았으므로 기본 재질이 사용됩니다.
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);
}
코드를 테스트하지 않았지만 정확해야합니다.
무엇을하려합니까? 겹쳐지는 텍스처를 의미합니까, 당신이 보는 와이어 프레임입니까? –