From 9fbdb9d84cc7fc58c2055eb116f560cbdb855b0c Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Thu, 7 Oct 2010 17:10:59 +0000 Subject: [PATCH] added test scenes for "for" and "if" statements git-svn-id: svn://anubis/fart/trunk@359 7f9b0f55-74a9-4bce-be96-3c2cd072584d --- scenes/for-test.fart | 41 ++++++++++++++++++++++++++++++++++ scenes/if-test.fart | 53 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 scenes/for-test.fart create mode 100644 scenes/if-test.fart diff --git a/scenes/for-test.fart b/scenes/for-test.fart new file mode 100644 index 0000000..f5f127f --- /dev/null +++ b/scenes/for-test.fart @@ -0,0 +1,41 @@ + +scene +{ + camera + { + position <0, 0, 40> + look_at <0, 100, 5> + } + + light + { + position <100, -100, 50> + } + + define material mat + { + color <0, 0.8, 1> + } + + plane + { + position <0, 0, 1>, 0 + material + { + color <0, 0.7, 0> + } + } + + for (local $x := -200; $x <= 200; $x := $x + 40) + { + for (local $y := 0; $y <= 4000; $y := $y + 40) + { + sphere + { + radius 10 + translate <$x, $y, 10> + material mat + } + } + } +} diff --git a/scenes/if-test.fart b/scenes/if-test.fart new file mode 100644 index 0000000..c1b238b --- /dev/null +++ b/scenes/if-test.fart @@ -0,0 +1,53 @@ + +scene +{ + camera + { + position <0, -80, 80> + look_at <0, 0, 5> + } + + light + { + position <100, -100, 100> + } + + define material mat { color <0, 0.8, 1> } + define material mat2 { color <1, 0.7, 0> } + define material mat3 { transparency 0.5 reflectance 0.7 } + + plane + { + position <0, 0, 1>, 0 + material + { + color <0, 0.7, 0> + } + } + + local $m := 0 + for (local $x := -100; $x <= 100; $x := $x + 40) + { + for (local $y := -100; $y <= 100; $y := $y + 40) + { + sphere + { + radius 10 + translate <$x, $y, 10> + if ($m % 3 = 0) + { + material mat + } + elsif ($m % 3 = 1) + { + material mat2 + } + else + { + material mat3 + } + } + $m := $m + 1 + } + } +}