a toolkit for developing cross-platform user interfaces with openGL (gradually migrating from github)
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

move write_shader_header() into python/shader_util.py

+40 -30
+5
.gitignore
··· 2 2 .lock-waf* 3 3 .waf* 4 4 5 + # python stuff 6 + __pycache__ 7 + *.pyc 8 + *.pyo 9 + 5 10 # build stuff 6 11 build/ 7 12
python/__init__.py

This is a binary file and will not be displayed.

+32
python/glsl2h.py
··· 1 + #!/usr/bin/env python 2 + 3 + def write_shader_header(outfile, infiles): 4 + output = "" 5 + 6 + shname = outfile.name 7 + shname = shname[:shname.find(".glsl.h")].replace("-", "_").upper() 8 + 9 + for file in infiles: 10 + if file.name.find("vert") > 0: 11 + shtype = "VERT" 12 + elif file.name.find("frag") > 0: 13 + shtype = "FRAG" 14 + else: 15 + raise Exception("i have no idea what kind of shader \"{0}\" is.".format(file.name)) 16 + 17 + output += "static const char *{0}_{1}_SHADER = ".format(shname, shtype) 18 + 19 + f = open(file.abspath()) 20 + for line in f: 21 + line = line.rstrip() 22 + 23 + if len(line) == 0: 24 + output += "\n" 25 + else: 26 + output += "\n\t\"{0}\\n\"".format(line.replace("\"", '\\\"')) 27 + 28 + output += ";\n\n" 29 + 30 + # get rid of the last newline 31 + output = output[:len(output) - 1] 32 + outfile.write(output)
+1 -30
src/wscript
··· 2 2 3 3 top = ".." 4 4 5 - def write_shader_header(outfile, infiles): 6 - output = "" 7 - 8 - shname = outfile.name 9 - shname = shname[:shname.find(".glsl.h")].replace("-", "_").upper() 10 - 11 - for file in infiles: 12 - if file.name.find("vert") > 0: 13 - shtype = "VERT" 14 - elif file.name.find("frag") > 0: 15 - shtype = "FRAG" 16 - else: 17 - raise Exception("i have no idea what kind of shader \"{0}\" is.".format(file.name)) 18 - 19 - output += "static const char *{0}_{1}_SHADER = ".format(shname, shtype) 20 - 21 - f = open(file.abspath()) 22 - for line in f: 23 - line = line.rstrip() 24 - 25 - if len(line) == 0: 26 - output += "\n" 27 - else: 28 - output += "\n\t\"{0}\\n\"".format(line.replace("\"", '\\\"')) 29 - 30 - output += ";\n\n" 31 - 32 - # get rid of the last newline 33 - output = output[:len(output) - 1] 34 - outfile.write(output) 5 + from glsl2h import write_shader_header 35 6 36 7 def shader_header(bld, dest): 37 8 def shader(task):
+2
wscript
··· 17 17 # print() (as a function) doesn't work in python <2.7 18 18 sys.stdout.write("\n") 19 19 20 + sys.path.append("./python") 21 + 20 22 # 21 23 # dep checking functions 22 24 #