Open luruke opened 5 years ago
i think my issue belongs here: i've been using usual ShaderMaterial
, and just noticed it only works for RawShaderMaterial
right now. It actually works perfectly if u just replace this dep in your code. But i guess there should be some more clever way for that.
And thank you again for implementing this idea! =)
Yeah, a solution could be:
import MagicShader from 'magicshader';
const material = new MagicShader(Material)({
fragmentShader:'...'
});
where Material
can be anything that inherits from THREE.Material
.
But I guess it would be just useful for RawShaderMaterial
and ShaderMaterial
...
Or a syntax like:
import { MagicShader, RawMagicShader} from 'magicshader';
where MagicShader
uses ShaderMaterial
and RawMagicShader
uses RawShaderMaterial
Just an idea, we could plug and use the
magic comments
everywhere on three.js without even using theMagicShader
class...