换模型+背景
This commit is contained in:
@@ -127,13 +127,12 @@ export default class Demo {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.gltfloader = new GLTFLoader();
|
||||
this.gltfloader.load(
|
||||
"/tunnelModel/chanel.glb",
|
||||
"/tunnelModel/chanel.gltf",
|
||||
(gltf) => {
|
||||
gltf.scene.traverse((child) => {
|
||||
this._forModels(child);
|
||||
});
|
||||
this.scene.add(gltf.scene);
|
||||
|
||||
// 加载完后可执行函数
|
||||
this._afterLoaded(gltf.scene);
|
||||
resolve(gltf);
|
||||
@@ -372,4 +371,14 @@ export default class Demo {
|
||||
setDistance(distance = 10) {
|
||||
this.distance = distance;
|
||||
}
|
||||
loadBackground(hdrLoader, backColorSet) {
|
||||
// hdrLoader.load("/images/background/background.hdr", (texture) => {
|
||||
// texture.mapping = this.THREE.EquirectangularReflectionMapping;
|
||||
// this.scene.background = texture;
|
||||
// this.scene.environment = texture;
|
||||
// })
|
||||
this.scene.background = new this.THREE.TextureLoader().load("/images/background/background.png", function (texture) {
|
||||
texture.encoding = backColorSet;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user