--Script for Fractracer v1.04
--This script describes:
--1) IFS Fern fractal (see http://en.wikipedia.org/wiki/Iterated_function_system)
--2) One camera
--3) One light source
--4) Layout of dialogs

--Copy this text to the Fractracer to build Fern

--here we include external file: "InstallDir\Fractracer\Inc\builder.ftsi"
--builder.ftsi contains helper routines and returns "builder" object (see Lua documentation for "require")
builder=require "inc\\builder"

fern=ifs{};--the Fern (2D IFS fractal)

--four affine tranforamtions
t1=ifs.affine3d.affine(  0,   0,   0,.16,0,  0);--transformation 1
t2=ifs.affine3d.affine(.85, .04,-.04,.85,0,1.6);--transformation 2
t3=ifs.affine3d.affine(.2, -.26, .23,.22,0,1.6);--transformation 3
t4=ifs.affine3d.affine(-.15,.28, .26,.24,0,.44);--transformation 4

--below you can see representation of equation: fern=t1(fern) U t2(fern) U t3(fern) U t4(fern) 
fern:eq
{	
	{t1,fern},--t1(fern), composition of t1 and fern
	{t2,fern},--t2(fern), composition of t2 and fern
	{t3,fern},--t3(fern), composition of t3 and fern
	{t4,fern},--t4(fern), composition of t4 and fern
	"u",--union
}

--camera
cam1=
{
id='camera1',
location={0.54893375368501,2.1509903435648,-13.725390102775},
look_at={0.1382599515339,4.538110685198,-0.00083215664834365},
sky={0,1,0},
fov=45,
--
}

--light source
lg1=
{
id='light1',
location={5.2141123500548,1.6391460907481,-0.39625475826166},
color={1,1,1},
diffuse=53.461226926204,
specular=42.686027445385,
shadows=0,
--
}

--environment
env1=
{
id='environment',
background={0.25098039215686,0.25098039215686,0.25098039215686,0},
ambient={0.50196078431373,0.50196078431373,0.50196078431373,0.0921659},
--
}

--windows layout
dlg_layout=
{
id='Layout1',
{'Window',0,0,1228,673,1,0,0,},
{'Output',0,782,1680,919,0,1,0,},
{'Camera',947,0,1228,673,0,1,1,},
{'Light Source',947,0,1228,673,1,1,1,},
{'Environment',947,0,1228,673,0,1,1,},
--
}

--start building
builder:start
{
	ifs={ifs.color(0.33,1,0.6),fern,},  --object to build
	cameras={cam1},                     --list of cameras
	lights={lg1},                       --list of light sources
	layout=dlg_layout,
	environment=env1,
}