You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-18 14:21:41 +00:00
New lightmapper
-Added LocalVector (needed it) -Added stb_rect_pack (It's pretty cool, we could probably use it for other stuff too) -Fixes and changes all around the place -Added library for 128 bits fixed point (required for Delaunay3D)
This commit is contained in:
@@ -740,5 +740,69 @@ def build_rd_headers(target, source, env):
|
||||
build_rd_header(str(x))
|
||||
|
||||
|
||||
class RAWHeaderStruct:
|
||||
def __init__(self):
|
||||
self.code = ""
|
||||
|
||||
|
||||
def include_file_in_raw_header(filename, header_data, depth):
|
||||
fs = open(filename, "r")
|
||||
line = fs.readline()
|
||||
text = ""
|
||||
|
||||
while line:
|
||||
|
||||
while line.find("#include ") != -1:
|
||||
includeline = line.replace("#include ", "").strip()[1:-1]
|
||||
|
||||
import os.path
|
||||
|
||||
included_file = os.path.relpath(os.path.dirname(filename) + "/" + includeline)
|
||||
include_file_in_raw_header(included_file, header_data, depth + 1)
|
||||
|
||||
line = fs.readline()
|
||||
|
||||
header_data.code += line
|
||||
line = fs.readline()
|
||||
|
||||
fs.close()
|
||||
|
||||
|
||||
def build_raw_header(filename):
|
||||
header_data = RAWHeaderStruct()
|
||||
include_file_in_raw_header(filename, header_data, 0)
|
||||
|
||||
out_file = filename + ".gen.h"
|
||||
fd = open(out_file, "w")
|
||||
|
||||
enum_constants = []
|
||||
|
||||
fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n")
|
||||
|
||||
out_file_base = out_file.replace(".glsl.gen.h", "_shader_glsl")
|
||||
out_file_base = out_file_base[out_file_base.rfind("/") + 1 :]
|
||||
out_file_base = out_file_base[out_file_base.rfind("\\") + 1 :]
|
||||
out_file_ifdef = out_file_base.replace(".", "_").upper()
|
||||
fd.write("#ifndef " + out_file_ifdef + "_RAW_H\n")
|
||||
fd.write("#define " + out_file_ifdef + "_RAW_H\n")
|
||||
fd.write("\n")
|
||||
fd.write("static const char " + out_file_base + "[] = {\n")
|
||||
for c in header_data.code:
|
||||
fd.write(str(ord(c)) + ",")
|
||||
fd.write("\t\t0};\n\n")
|
||||
fd.write("#endif\n")
|
||||
fd.close()
|
||||
|
||||
|
||||
def build_rd_headers(target, source, env):
|
||||
for x in source:
|
||||
build_rd_header(str(x))
|
||||
|
||||
|
||||
def build_raw_headers(target, source, env):
|
||||
for x in source:
|
||||
build_raw_header(str(x))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
subprocess_main(globals())
|
||||
|
||||
Reference in New Issue
Block a user