diff options
Diffstat (limited to 'methods.py')
-rw-r--r-- | methods.py | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/methods.py b/methods.py index 2f9d45897e..30a1f3caed 100644 --- a/methods.py +++ b/methods.py @@ -244,6 +244,7 @@ def build_glsl_header(filename): fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU GLfloat col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; glUniform4fv(get_uniform(p_uniform),1,col); }\n\n") fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU GLfloat vec2[2]={p_vec2.x,p_vec2.y}; glUniform2fv(get_uniform(p_uniform),1,vec2); }\n\n") fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU GLfloat vec3[3]={p_vec3.x,p_vec3.y,p_vec3.z}; glUniform3fv(get_uniform(p_uniform),1,vec3); }\n\n") + fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Plane& p_plane) { _FU GLfloat plane[4]={p_plane.normal.x,p_plane.normal.y,p_plane.normal.z,p_plane.d}; glUniform4fv(get_uniform(p_uniform),1,plane); }\n\n") fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU glUniform2f(get_uniform(p_uniform),p_a,p_b); }\n\n") fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU glUniform3f(get_uniform(p_uniform),p_a,p_b,p_c); }\n\n") fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU glUniform4f(get_uniform(p_uniform),p_a,p_b,p_c,p_d); }\n\n") @@ -1176,6 +1177,20 @@ def update_version(): f.write("#define VERSION_STATUS " + str(version.status) + "\n") import datetime f.write("#define VERSION_YEAR " + str(datetime.datetime.now().year) + "\n") + f.close() + + fhash = open("core/version_hash.gen.h", "wb") + githash = "" + if os.path.isfile(".git/HEAD"): + head = open(".git/HEAD", "rb").readline().strip() + if head.startswith("ref: "): + head = ".git/" + head[5:] + if os.path.isfile(head): + githash = open(head, "rb").readline().strip() + else: + githash = head + fhash.write("#define VERSION_HASH \"" + githash + "\"") + fhash.close() def parse_cg_file(fname, uniforms, sizes, conditionals): @@ -1513,23 +1528,26 @@ def split_lib(self, libname): def save_active_platforms(apnames, ap): for x in ap: - pth = x + "/logo.png" -# print("open path: "+pth) - pngf = open(pth, "rb") - b = pngf.read(1) - str = " /* AUTOGENERATED FILE, DO NOT EDIT */ \n" - str += " static const unsigned char _" + x[9:] + "_logo[]={" - while(len(b) == 1): - str += hex(ord(b)) - b = pngf.read(1) - if (len(b) == 1): - str += "," + names = ['logo'] + if os.path.isfile(x + "/run_icon.png"): + names.append('run_icon') - str += "};\n" - - wf = x + "/logo.gen.h" - logow = open(wf, "wb") - logow.write(str) + for name in names: + pngf = open(x + "/" + name + ".png", "rb") + b = pngf.read(1) + str = " /* AUTOGENERATED FILE, DO NOT EDIT */ \n" + str += " static const unsigned char _" + x[9:] + "_" + name + "[]={" + while(len(b) == 1): + str += hex(ord(b)) + b = pngf.read(1) + if (len(b) == 1): + str += "," + + str += "};\n" + + wf = x + "/" + name + ".gen.h" + pngw = open(wf, "wb") + pngw.write(str) def no_verbose(sys, env): |