Skip to content

Commit

Permalink
Merge pull request #10 from LANIK2000/norm_script
Browse files Browse the repository at this point in the history
Made python script output norm code
  • Loading branch information
W2Wizard authored Feb 26, 2022
2 parents c56cd61 + d43524c commit 13a181d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tools/compile_shader.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# By: tbruinem <tbruinem@student.codam.nl> +#+ #
# +#+ #
# Created: 2022/02/17 22:35:29 by tbruinem #+# #+# #
# Updated: 2022/02/17 23:09:33 by w2wizard ######## odam.nl #
# Updated: 2022/02/26 15:18:00 by rdrazsky ######## odam.nl #
# #
# **************************************************************************** #

Expand All @@ -16,14 +16,14 @@
import os

if (len(sys.argv) != 2):
exit(1)
exit(1)
file_path = sys.argv[1]

lines = [x for x in open(file_path).read().split('\n') if x]

shadertype = os.path.splitext(file_path)[1]

header = '''
header = '''\
/* ************************************************************************** */
/* */
/* :::::::: */
Expand All @@ -41,8 +41,8 @@
output.append(header)
output.append("// If you wish to modify this file edit the .vert or .frag file!\n")
output.append("#include \"MLX42/MLX42_Int.h\"\n")
output.append(f"const char *g_{shadertype[1:]}_shader = \"{lines[0]}\\n\"")
output.extend(["\"" + line + "\"" for line in lines[1:]])
output.append(";");
output.append(f"const char *g_{shadertype[1:]}_shader = \"{lines[0]}\\n\"")
output.extend([" \"" + line + "\"" for line in lines[1:]])
output[-1] += ';'
for line in output:
print(line)
print(line)

0 comments on commit 13a181d

Please sign in to comment.