X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=scripts%2Fmaketex.py;fp=scripts%2Fmaketex.py;h=916ce747c404f8b26210078a0e07b7d53f8b5fbf;hb=e0e6d12dc7f55a1033e6939dcccdc04e4b469692;hp=520be8424b02f39740b663bd03fc83c736e05f54;hpb=72a02f2f3f1c454aa670b256262d7bc0541222e3;p=libs%2Fgl.git diff --git a/scripts/maketex.py b/scripts/maketex.py index 520be842..916ce747 100755 --- a/scripts/maketex.py +++ b/scripts/maketex.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 def escape(str): result = "" @@ -8,7 +8,7 @@ def escape(str): elif c=='\\': result += '\\\\' elif ord(c)<0x20: - result += "\\%03o"%ord(c) + result += "\\{:03o}".format(ord(c)) else: result += c return result @@ -27,14 +27,14 @@ def make_tex(fn, filter="LINEAR", anisotropy=0, wrap=None, srgb=False): if srgb: fmt = "S"+fmt - result = "storage %s %d %d;\n"%(fmt, img.size[0], img.size[1]) - result += "filter %s;\n"%filter + result = "storage {} {} {};\n".format(fmt, img.size[0], img.size[1]) + result += "filter {};\n".format(filter) if "MIPMAP" in filter: result += "generate_mipmap true;\n" if anisotropy: - result += "max_anisotropy %d;\n"%anisotropy + result += "max_anisotropy {};\n".format(anisotropy) if wrap: - result += "wrap %s;\n"%wrap + result += "wrap {};\n".format(wrap) result += "raw_data \"" data = list(img.getdata()) for y in range(img.size[1]): @@ -68,5 +68,5 @@ if __name__=="__main__": out_fn = args.output if not out_fn: out_fn = os.path.splitext(args.image)[0]+".tex2d" - out = file(out_fn, "w") + out = open(out_fn, "w") out.write(make_tex(args.image, filter, args.anisotropy, args.wrap, args.srgb))