Skip to content

Commit

Permalink
fix(shadermaterial): adds uniform clone preventing the use of the sam…
Browse files Browse the repository at this point in the history
…e instance (#283)
  • Loading branch information
emmelleppi authored Feb 3, 2021
1 parent dcd7fe9 commit 7a4e72a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/core/shaderMaterial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ export function shaderMaterial(
const entries = Object.entries(uniforms)
// Create unforms and shaders
super({
uniforms: entries.reduce((acc, [name, value]) => ({ ...acc, [name]: { value } }), {}),
uniforms: entries.reduce((acc, [name, value]) => {
const uniform = THREE.UniformsUtils.clone({ [name]: { value } })
return {
...acc,
...uniform,
}
}, {}),
vertexShader,
fragmentShader,
})
Expand Down

0 comments on commit 7a4e72a

Please sign in to comment.