Skip to content

Commit

Permalink
Circle rendering tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
robotman2412 committed Jan 30, 2024
1 parent d8b8d65 commit ea6b81c
Show file tree
Hide file tree
Showing 6 changed files with 246 additions and 241 deletions.
8 changes: 4 additions & 4 deletions precalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def precalcCircle(fd_c, fd_h, resolution, id):
fd_c.write("// Circle: " + str(resolution) + " segments\n")
fd_c.write("const pax_vec2f pax_precalc_" + id + "[" + str(resolution + 1) + "] = {\n")
for i in range(resolution + 1):
angle = i * delta
angle = i * delta + delta / 2
fd_c.write("\t{" + str(math.cos(angle)) + ", " + str(math.sin(angle)) + "},\n")
fd_c.write("};\n\n")

Expand All @@ -21,8 +21,8 @@ def precalcCircle(fd_c, fd_h, resolution, id):
fd_c.write("// Circle UVs: " + str(resolution) + " segments\n")
fd_c.write("const pax_trif pax_precalc_uv_" + id + "[" + str(resolution - 1) + "] = {\n")
for i in range(resolution - 1):
a1 = i * delta
a2 = (i + 1) * delta
a1 = i * delta + delta / 2
a2 = (i + 1) * delta + delta / 2
fd_c.write("\t{1, 0.5, ")
fd_c.write(str(math.cos(a1)/2+0.5) + ", " + str(math.sin(a1)/2+0.5) + ", ")
fd_c.write(str(math.cos(a2)/2+0.5) + ", " + str(math.sin(a2)/2+0.5))
Expand All @@ -40,7 +40,7 @@ def precalcCircle(fd_c, fd_h, resolution, id):
out_h.write("// This file contains precalculated math operations.\n")
out_c.write("// clang-format off\n\n")
out_h.write("#include \"pax_types.h\"\n\n")
precalcCircle(out_c, out_h, 4, "circle_4")
precalcCircle(out_c, out_h, 8, "circle_8")
precalcCircle(out_c, out_h, 16, "circle_16")
precalcCircle(out_c, out_h, 24, "circle_24")
precalcCircle(out_c, out_h, 32, "circle_32")
Expand Down
Loading

0 comments on commit ea6b81c

Please sign in to comment.