X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=src%2Fshader.c;h=934d30d28c1ee2ead86f7a16632a136c637540ea;hb=fac9f6fff674421f27fa4f4c1d2844998f0003d6;hp=f5e7b360da8e9703a5da66e18f4e83b43a2fdaa8;hpb=e0a13e1caa93d989f73f76ba6df2e2714d8edfab;p=vg.git diff --git a/src/shader.c b/src/shader.c index f5e7b36..934d30d 100644 --- a/src/shader.c +++ b/src/shader.c @@ -8,6 +8,8 @@ struct uniform { char name[30]; char type[20]; + + int array; } uniform_buffer[100]; static int uniform_count; @@ -44,6 +46,7 @@ static int compile_subshader( FILE *header, char *name ) { start += 8; struct uniform *uf = &uniform_buffer[ uniform_count ++ ]; + uf->array = 0; for( int i=0;; i++ ) { if( start[i] == '\0' ) @@ -54,6 +57,13 @@ static int compile_subshader( FILE *header, char *name ) start[i] = '\0'; strncpy( uf->name, start, sizeof(uf->name) ); } + + if( start[i] == '[' ) + { + start[i] = '\0'; + strncpy( uf->name, start, sizeof(uf->name) ); + uf->array = 1; + } if( start[i] == ' ' ) { @@ -143,6 +153,8 @@ int main( int argc, char *argv[] ) for( int i=0; iarray ) continue; + if( !strcmp(uf->type,"vec2") ) { fprintf( header, "static void shader_%s_%s(v2f v){\n"