Reactjs 使用ThreeJS&Dat.Gui更新网格的纹理
我想我的网格纹理更新时,点击功能 单击“UpdateMatria”函数时,我希望网格处理其当前纹理并添加新纹理 动画循环 Dat.GuiReactjs 使用ThreeJS&Dat.Gui更新网格的纹理,reactjs,three.js,dat.gui,Reactjs,Three.js,Dat.gui,我想我的网格纹理更新时,点击功能 单击“UpdateMatria”函数时,我希望网格处理其当前纹理并添加新纹理 动画循环 Dat.Gui 当我将函数直接放入“动画循环”时,这实际上会将纹理更新为所需的纹理,但当前版本首先给出了“TypeError:无法读取未定义的属性“dispose”,您不能在updateMaterial中使用此引用,可能是updateMaterial???。考虑在这个函数的外部变量中引用这个引用,而不是使用这个变量。此外,如果只想更改纹理,则无需处理材质 userGUI =
当我将函数直接放入“动画循环”时,这实际上会将纹理更新为所需的纹理,但当前版本首先给出了“TypeError:无法读取未定义的属性“dispose”,您不能在updateMaterial中使用此引用,可能是updateMaterial???。考虑在这个函数的外部变量中引用这个引用,而不是使用这个变量。此外,如果只想更改纹理,则无需处理材质
userGUI = () => {
const scope = this;
const update = {
updateMateria: function() {
alert('Changing');
// scope.material.dispose();
scope.material.map = texture1();
}
}
this.gui = new dat.GUI();
const controls = function() {
this.title = new controls();
this.gui.add(update, 'updateMateria')
}
3.js R108
userGUI = () => {
const update = {
updateMateria: function() {
alert('Changing');
this.material.dispose();
this.material.map = texture1();
}
}
this.gui = new dat.GUI();
const controls = function() {
this.title = new controls();
this.gui.add(update, 'updateMateria')
}
}
userGUI = () => {
const scope = this;
const update = {
updateMateria: function() {
alert('Changing');
// scope.material.dispose();
scope.material.map = texture1();
}
}
this.gui = new dat.GUI();
const controls = function() {
this.title = new controls();
this.gui.add(update, 'updateMateria')
}