Skip to content

Commit

Permalink
Set initial rendering to 0 iterations
Browse files Browse the repository at this point in the history
 - The initial rendering used to be 0 iterations, but I had changed this
   due to the bug where I was forgetting to set the initial string length.
   Now that the string length bug is fixed, I can return to starting at
   the more obvious place: the system's "init" string.
  • Loading branch information
Nathan O authored and Nathan O committed Feb 17, 2022
1 parent 24515ca commit 3e646d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
16 changes: 8 additions & 8 deletions config.txt
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
init CP
init P

# I use the () to revert the position back to the "current" pyramid's bottom
# left, facing right, in preparation for drawing the next pyramid.

# Replace one square pyramid with 5 pyramids, always ending at the bottom left
# corner facing right.
P ((CPN1PN-N2PN-N3P)UND4P)
P ((1PN2PN-N3PN-N4P)UND5P)

# N is used to move forward the width of a single pyramid. It doubles every
# iteration, since every existing pyramid's width doubles at the same rate.
N NN

actions

# C, 1, 2, 3, and 4 all just set colors. You can remove them from the
# 1, 2, 3, 4, and 5 all just set colors. You can remove them from the
# replacement string to simplify it if you want.
C
1
set_color_r 0.7
set_color_g 0.3
set_color_b 1.0

1
2
set_color_r 1.0
set_color_g 0.2
set_color_b 0.2

2
3
set_color_r 0.2
set_color_g 1.0
set_color_b 0.2

3
4
set_color_r 0.2
set_color_g 0.2
set_color_b 1.0

4
5
set_color_r 1.0
set_color_g 1.0
set_color_b 1.0
Expand Down
6 changes: 1 addition & 5 deletions l_system_3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,7 @@ int main(int argc, char **argv) {
to_return = 1;
goto cleanup;
}
if (!IncreaseIterations(s)) {
printf("Error running first L-system iteration.\n");
to_return = 1;
goto cleanup;
}
s->l_system_length = strlen(s->config->init);
if (!GenerateVertices(s)) {
printf("Failed generating vertices.\n");
to_return = 1;
Expand Down

0 comments on commit 3e646d8

Please sign in to comment.