Skip to content

glsl loader for webpack working with chunks (inspired by ShaderLoader from cabbibo)

Notifications You must be signed in to change notification settings

Makio64/shader-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

glsl shader loader for webpack

glsl loader for webpack working with chunks writed by @makio64 & inspired by ShaderLoader from @cabbibo

Getting started

install: npm install shader-loader

config webpack:

module: {
	loaders: [
		{ test: /\.glsl$/, loader: 'shader' },
	],
},

shader: {
	// chunks folder, chunkpath by default is ""
	chunkPath: "chunks"
}

use it:

var myShader-vx = require("./myShader-vx.glsl");
// => returns myShader-vx.glsl as string and with the chunks replaced

Chunk it!

if you use the synthax $name in your shader it will be replaced by the content of name.glsl ( example with $fog above ) :

void main(void) {
	gl_FragColor = vec4(1.0);
	$fog //replace by the content of chunks/fog.glsl
}

License

MIT (http://www.opensource.org/licenses/mit-license.php)

About

glsl loader for webpack working with chunks (inspired by ShaderLoader from cabbibo)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •