RaananW / babylonjs-webpack-es6

Babylon.js basic scene with typescript, webpack, es6 modules, editorconfig, eslint, hot loading and more. Will even make coffee if you ask nicely.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New Feature: Add support for shader imports

DiogoNeves opened this issue Β· comments

Hi πŸ‘‹

Apologies if this is already supported and I missed it!
Do you think it would be worth adding support for shader code imports?

I'm happy to do it with some support on getting it with the right structure.

In my project I:

Created a folder in src/glsl for the shaders.
Currently each effect is a subfolder and includes the vertex and fragment shaders if necessary (e.g. src/glsl/effect/vertex.glsl).

Added this to the webpack.common.js config:

{
  test: /\.(glsl|vs|fs)$/,
  loader: 'ts-shader-loader',
  exclude: /node_modules/,
},

Still had to add the glsl.d.ts file to the src/glsl folder, containing:

declare module '*.glsl' {
  const value: string;
  export default value;
}

Let me know what you think

Oh, no, it isn't supported yet! Great idea.
Want to submit a PR, or would you rather wait until I have the time to add that?

I can do soonish 😊 are you ok with that folder structure?

the one bit I need help with is coming up with an example if necessary, but I can start without

Sure, i'm fine with the dir structure :-)

I am assigning myself to not forget about it, but feel free to update about progress on your side :-)

FYI I'm starting on this now. It's my first contribution so it may take a little longer than expected πŸ˜…

Ok, PR is up @RaananW I tried to provide details, but let me know if you need more information.
I also understand if you prefer not to merge πŸ˜‰

Thanks again :-)

I thank you for letting me contribute πŸ˜… glad it was ok