mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
Recreate material if vert/frag shaders change
This commit is contained in:
parent
e9e2ac7bce
commit
9183cabf6a
@ -25,6 +25,12 @@ export default {
|
||||
['uniforms', 'vertexShader', 'fragmentShader'].forEach(p => {
|
||||
watch(() => this[p], (value) => {
|
||||
this.material[p] = value;
|
||||
|
||||
if (p === 'vertexShader' || p === 'fragmentShader') {
|
||||
// recreate material if we change either shader
|
||||
this.material.dispose();
|
||||
this.createMaterial();
|
||||
}
|
||||
},
|
||||
// only watch deep on uniforms
|
||||
{ deep: p === 'uniforms' }
|
||||
|
Loading…
Reference in New Issue
Block a user