Change shader loader to allow using ShaderChunks
aggregate1166877 opened this issue · 2 comments
aggregate1166877 commented
[Parent issue: #74]
Details:
The current shader loading mechanism uses flat text files. While this allows easy separation of concerns, it means we miss out on the hard work the Three.js team did on ShaderChunks.
- Move the shaders directory into
app/shaders
. - Rewrite shader files as
.js
files. - Shaders should be stored as template strings that allow injecting JS variables.
Shaders and the functions that use them should not necessarily have the same names. For example, an item pickup might use a glow shader named- Out of scope, will implement at a later stage.wisp
, which the user might not like and change so that pickups use a shader namedblackbody
instead.
aggregate1166877 commented
As a side note, it turns out Three.js has an #include
directive which can be used to import shader chunks defined within the library.
aggregate1166877 commented
Done.