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

feat: import chunk #9

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

homerjam
Copy link

@homerjam homerjam commented Feb 11, 2021

This PR includes rather a lot of whitespace and prettier formatting I'm afraid : )

If you like the feature I can tidy it up!

The basic idea is to allow you to easily include chunks from the default threejs shaders in your own, like so:

// myfancyshader.frag

// includes the header chunk
#pragma glslify: import('three/src/renderers/shaders/ShaderLib/meshbasic_vert.glsl.js')(/`(.*)void main/gs)

// custom header

void main() {
  // includes the main chunk
  #pragma glslify: import('three/src/renderers/shaders/ShaderLib/meshbasic_vert.glsl.js')(/void main\(\) {(.*)}/gs)

  // custom main
}

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.

1 participant