1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 04:12:02 +08:00

Change id to name in CubeTexture

This commit is contained in:
Sander Moolin 2021-03-15 11:46:09 -04:00
parent 99b888b27b
commit e31900d467

View File

@ -13,7 +13,7 @@ export default {
onLoad: Function, onLoad: Function,
onProgress: Function, onProgress: Function,
onError: Function, onError: Function,
id: { type: String, default: 'envMap' }, name: { type: String, default: 'envMap' },
refraction: Boolean, refraction: Boolean,
// todo: remove ? // todo: remove ?
refractionRatio: { type: Number, default: 0.98 }, refractionRatio: { type: Number, default: 0.98 },
@ -24,7 +24,7 @@ export default {
watch(() => this.urls, this.refreshTexture); watch(() => this.urls, this.refreshTexture);
}, },
unmounted() { unmounted() {
this.material.setTexture(null, this.id); this.material.setTexture(null, this.name);
this.texture.dispose(); this.texture.dispose();
}, },
methods: { methods: {
@ -35,7 +35,7 @@ export default {
}, },
refreshTexture() { refreshTexture() {
this.createTexture(); this.createTexture();
this.material.setTexture(this.texture, this.id); this.material.setTexture(this.texture, this.name);
if (this.refraction) { if (this.refraction) {
this.texture.mapping = CubeRefractionMapping; this.texture.mapping = CubeRefractionMapping;
this.material.setProp('refractionRatio', this.refractionRatio); this.material.setProp('refractionRatio', this.refractionRatio);