@maptalks/rollup-plugin-glsl-minify
v0.1.7
Published
through stream that transforms glsl-parser AST nodes and rewrites variables into shorter forms
Downloads
3
Readme
rollup-plugin-glsl-minify
A rollup plugin to minify glsl on the fly.
Known issues to avoid
- property confliction albedo conflicts with materialUniforms.albedo
vec4 albedo = vec4(1.0);
materialUniforms.albedo *= albedo.rgb;
- variable name in vec4
uniform vec2 texSize;
void main() {
vec2 invSize = 1.0 / texSize;
//vec4(invSize, invSize); will be transformed to vec4(a)
vec2 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);
gl_FragColor = uvOffset;
}
built-in name conflicts (内置函数名不能用于变量名)
- distance
变量名不能太简单,例如单字母,会与混淆生成的变量名冲突