-USING: accessors arrays assocs colors combinators.short-circuit
-kernel locals math math.functions math.matrices math.order
-math.parser math.trig math.vectors opengl opengl.demo-support
-opengl.gl sbufs sequences strings ui.gadgets ui.gadgets.worlds
-ui.gestures ui.render ;
+USING: accessors arrays assocs calendar colors
+combinators.short-circuit kernel locals math math.functions
+math.matrices math.order math.parser math.trig math.vectors
+opengl opengl.demo-support opengl.gl sbufs sequences strings
+threads ui.gadgets ui.gadgets.worlds ui.gestures ui.render ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-TUPLE: <L-system> < gadget camera display-list commands axiom rules string ;
+TUPLE: <L-system> < gadget
+ camera display-list pedestal paused commands axiom rules string ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: iterate-system ( GADGET -- ) GADGET pedestal>> 0.5 + GADGET (>>pedestal) ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: start-rotation-thread ( GADGET -- )
+ GADGET f >>paused drop
+ [
+ [
+ GADGET paused>>
+ [ f ]
+ [ GADGET iterate-system GADGET relayout-1 25 milliseconds sleep t ]
+ if
+ ]
+ loop
+ ]
+ in-thread ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! draw axis
white gl-color GL_LINES glBegin { 0 0 0 } gl-vertex { 0 0 1 } gl-vertex glEnd
+ ! rotate pedestal
+
+ L-SYSTEM pedestal>> 0 0 1 glRotated
+
L-SYSTEM display-list>> glCallList ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
{ T{ key-down f f "a" } [ [ 1 step-turtle ] with-camera ] }
{ T{ key-down f f "z" } [ [ -1 step-turtle ] with-camera ] }
+ { T{ key-down f f "q" } [ [ 5 roll-left ] with-camera ] }
+ { T{ key-down f f "w" } [ [ 5 roll-right ] with-camera ] }
+
+ { T{ key-down f f "r" } [ start-rotation-thread ] }
+
{
T{ key-down f f "x" }
[
: L-system ( -- L-system )
<L-system> new-gadget
+
+ 0 >>pedestal
- turtle 45 turn-left 45 pitch-up 5 step-turtle 180 turn-left >>camera ;
+ ! turtle 45 turn-left 45 pitch-up 5 step-turtle 180 turn-left >>camera ;
+
+ turtle 90 pitch-down -5 step-turtle 2 strafe-up >>camera
+
+ dup start-rotation-thread
+
+ ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!