Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move glsl code from ShaderLib to *.glsl files using the new #include system #8223

Merged
merged 3 commits into from
Feb 25, 2016

Conversation

bhouston
Copy link
Contributor

I've split out all of the inlined glsl code from ShaderLib.js moved it into the directory:

three.js\src\renderers\shaders\ShaderLib

Basically I followed the pattern that ShaderChunk\ directory contained the contents of ShaderChunk.js so ShaderLib\ directory would contain the contents of ShaderLib.js.

I love this new layout, it makes editing the glsl so easy and now I have syntax highlighting.

I also added very simplistic error checking for the includeParser to know when an include can not be found.

@bhouston bhouston force-pushed the material_glsl_files branch from 91e713f to 807a8ec Compare February 24, 2016 22:15
@bhouston
Copy link
Contributor Author

@mrdoob, this is a major restructuring PR which will become invalid if other things are merged as those merges will not be reflected in the separated out *.glsl files. Sort of annoying that major restructuring PR like this one are so fragile. I do not mind if you want to do this at some point in the future and not today.

@@ -194,11 +194,12 @@ THREE.WebGLProgram = ( function () {

function parseIncludes( string ) {

var pattern = /#include +<([\w\d.]+)>/g;
var pattern = /#include[ \t]+<([\w\d.]+)>/g;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why also tabs? I would be strict about it...

@mrdoob mrdoob merged commit 807a8ec into mrdoob:dev Feb 25, 2016
@bhouston bhouston deleted the material_glsl_files branch March 14, 2016 13:45
@bhouston bhouston mentioned this pull request Jul 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants