-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
73 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule bonsai_stdlib
updated
8 files
+8 −1 | bonsai_stdlib.h | |
+25 −11 | docs/dependencies.md | |
+3 −0 | scripts/setup_for_cxx.sh | |
+1,252 −0 | src/arccostable.h | |
+3,929 −0 | src/costable.h | |
+184 −94 | src/maff.h | |
+5 −14 | src/random.h | |
+3 −16 | src/vector.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#! /bin/python | ||
|
||
# Generates arrays of pre-calculated cosine & arccosine values as literals for C. | ||
|
||
from math import acos, cos, pi | ||
|
||
def gen_cos_table(f, PRECISION, NAME, math_func): | ||
f.write("global_variable f32 %s[] = {\n" % NAME) | ||
j = 0 | ||
p = 0.0 | ||
while True: | ||
f.write("{:.10f}f, ".format(math_func(p))) | ||
j += 1 | ||
if j % 16 == 0: | ||
f.write("\n") | ||
p += PRECISION | ||
if p > 2*pi: | ||
break | ||
f.write("1.f, 1.f };// NOTE(Jesse): Add a duplicate for the max value so we can blindly add 1 to the lookup index and not overflow (to lerp)\n") | ||
|
||
def gen_acos_table(f, PRECISION, NAME, math_func): | ||
f.write("global_variable f32 %s[] = {\n" % NAME) | ||
j = 0 | ||
p = -1.0 | ||
while True: | ||
f.write("{:.10f}f, ".format(math_func(p))) | ||
j += 1 | ||
if j % 16 == 0: | ||
f.write("\n") | ||
p += PRECISION | ||
if p > 1.0: | ||
break | ||
f.write("0.f, 0.f }; // NOTE(Jesse): Add a duplicate for the max value so we can blindly add 1 to the lookup index and not overflow (to lerp)\n") | ||
|
||
|
||
if __name__ == '__main__': | ||
gen_cos_table(open("external/bonsai_stdlib/src/costable.h", "w"), 0.0001, "CosineTable", cos) | ||
gen_acos_table(open("external/bonsai_stdlib/src/arccostable.h", "w"), 0.0001, "ArcCosineTable", acos) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters