boids.ui: Use processing.shapes
parent
7a3a0d3677
commit
86a881f1f2
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
USING: combinators.short-circuit kernel namespaces
|
USING: combinators.short-circuit kernel namespaces
|
||||||
math
|
math
|
||||||
|
math.trig
|
||||||
math.functions
|
math.functions
|
||||||
math.vectors
|
math.vectors
|
||||||
math.parser
|
math.parser
|
||||||
|
@ -21,7 +22,8 @@ USING: combinators.short-circuit kernel namespaces
|
||||||
ui.gestures
|
ui.gestures
|
||||||
assocs.lib vars rewrite-closures boids accessors
|
assocs.lib vars rewrite-closures boids accessors
|
||||||
math.geometry.rect
|
math.geometry.rect
|
||||||
newfx ;
|
newfx
|
||||||
|
processing.shapes ;
|
||||||
|
|
||||||
IN: boids.ui
|
IN: boids.ui
|
||||||
|
|
||||||
|
@ -29,17 +31,22 @@ IN: boids.ui
|
||||||
! draw-boid
|
! draw-boid
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
: point-a ( boid -- a ) pos>> ;
|
: draw-boid ( boid -- )
|
||||||
|
glPushMatrix
|
||||||
: point-b ( boid -- b ) [ pos>> ] [ vel>> normalize* 20 v*n ] bi v+ ;
|
dup pos>> gl-translate-2d
|
||||||
|
vel>> first2 rect> arg rad>deg 0 0 1 glRotated
|
||||||
: boid-points ( boid -- point-a point-b ) [ point-a ] [ point-b ] bi ;
|
{ { 0 5 } { 0 -5 } { 20 0 } } triangle
|
||||||
|
glPopMatrix ;
|
||||||
: draw-boid ( boid -- ) boid-points gl-line ;
|
|
||||||
|
|
||||||
: draw-boids ( -- ) boids> [ draw-boid ] each ;
|
: draw-boids ( -- ) boids> [ draw-boid ] each ;
|
||||||
|
|
||||||
: display ( -- ) black gl-color draw-boids ;
|
: boid-color ( -- color ) { 1.0 0 0 0.3 } ;
|
||||||
|
|
||||||
|
: display ( -- )
|
||||||
|
white gl-clear
|
||||||
|
boid-color >fill-color
|
||||||
|
2 glLineWidth
|
||||||
|
draw-boids ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue