% Polyfilm sorting demo % visualises the sort algorithm used by render type one "\data\cube1.3d"; type two "\data\cube2.3d"; type three "\data\cube3.3d"; type four "\data\cube4.3d"; prefs "\data\sph_pref.prf"; palette 1; object III type three at [-300,100,700] looking [180*16,0,0]; object IV type four at [-100,100,700] looking [180*16,0,0]; object II type two at [100,100,700] looking [180*16,0,0]; object I type one at [300,100,700] looking [180*16,0,0]; camera camI at [0,0,0] looking [0,0,0] active; lightsource lig at [0,0,500] lit; simkey " " { if [I.waiting]{ kick I; kick II; kick III; kick IV; I.waiting=0; I.goshuf=0; } } simkey "8" { rotate camI by [0,16,0]; } simkey "2" { rotate camI by [0,-16,0]; } simkey "4" { rotate camI by [16,0,0]; } simkey "6" { rotate camI by [-16,0,0]; } simkey "q" { move camI by [0,16,0]; } simkey "a" { move camI by [0,-16,0]; } simkey "o" { move camI by [16,0,0]; } simkey "p" { move camI by [-16,0,0]; } I.waiting=0; I.goshuf=0; I.main[]{ waiting=1; goshuf=0; wait; wait; sortby[1]; } II.main[]{ wait; sortby[1]; sortup[]; } III.main[]{ wait; sortup[]; sortup[]; endsim; } IV.main[]{ wait; sortup[]; sortup[]; } camI.main[]{ wait; } lig.main[]{ wait; } shuffle [targetx] { if [ xtargetx ] { move speed [-10,0,0]; } } wait [x=targetx]; stop move; } raise [targety] { if [ ytargety ] { move speed [0,-10,0]; } } wait [y=targety]; stop move; } sortby[dest]{ raise [y-200]; I.goshuf=1; shuffle [100+200*(dest-3)]; raise [y+200]; I.waiting=1; wait; } sortup[]{ wait [I.goshuf=1]; shuffle [x+200]; wait; }