Open
Description
a.glsl
#ifdef HELLO
#pragma glslify: b = require('./b.glsl')
float a(float x) {
return b(x);
}
#else
float a(float x) {
return x * 10.0;
}
#endif
#pragma glslify:export(a)
b.glsl
float b(float x) {
return x * 11.11;
}
#pragma glslify:export(b)
c.glsl
#pragma glslify: a = require('./a.glsl')
#pragma glslify: b = require('./b.glsl')
void main() {
gl_FragColor = vec4(a(1.0), b(1.0), 0.0, 0.0);
}
glslify < c.glsl
#define GLSLIFY 1
#ifdef HELLO
float b(float x) {
return x * 11.11;
}
float a(float x) {
return b(x);
}
#else
float a(float x) {
return x * 10.0;
}
#endif
void main() {
gl_FragColor = vec4(a(1.0), b(1.0), 0.0, 0.0);
}
the problem is, no function b
when HELLO
is undefined, it will caused some issue.
so maybe glslify shouldn't do too much processing, user could use macros to avoid multiple require like C/C++.
Metadata
Metadata
Assignees
Labels
No labels