换模型+背景

This commit is contained in:
Hcat1314
2023-12-09 13:05:10 +08:00
parent 2f06c69384
commit f0b46b1c24
5 changed files with 16688 additions and 12 deletions

View File

@@ -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;
});
}
}