and i am wondering how i can import them to the module? as i can’t use the above because they load either to soon (before three.js module) or to late so the code doesn’t work any ideas of how i can use import with these two files?
or is there any other tricks i can use?
but it would be a mess, you’re better off just forking/copying the thing.
edit. read your stackoverflow question, copying means you throw the thing into your project and then re-write it. you don’t need to mutate the THREE namespace, just form a shadermaterial:
you can copy the shader material as is, though i removed the simplex chunk because you can load that with imports, too (im using macros here because of codesandbox).
as for the “Fire” thing, you can tie it together in a class Fire extends THREE.Mesh, it still needs a texture in the end to function.
everything seems to load now im using vanila js so nothing special like react and i keep getting this MIME type error:
Failed to load module script: The server responded with a non-JavaScript MIME type of “image/png”. Strict MIME type checking is enforced for module scripts per HTML spec.
on the fire.png image
also in the normal js version i can do things like this:
esm spec does not support importing non-js assets (images). so the image must be in your public folder, the whole project needs then to be served (as in, you need a server), you can’t just run it locally by loading the html. generally i would suggest you use bundlers, “vanilla esm” is pretty much unusable at this point, the spec is years from being finished.
you can clone and scale the object. for cloning you need to override the clone method.