bunny-world


Vocabulary
bunny

Definition
USING: opengl.demo-support ;

IN: bunny

TUPLE: bunny-world < demo-world
model-triangles geom draw-seq draw-n ;


Methods
USING: accessors bunny bunny.model kernel opengl.demo-support
opengl.gl ui.gadgets.worlds ;

M: bunny-world begin-world
GL_DEPTH_TEST glEnable 0.0 0.0 0.375 set-demo-orientation
maybe-download read-model
[ >>model-triangles ] [ <bunny-geom> >>geom ] bi
dup make-draws >>draw-seq 0 >>draw-n drop ;


USING: accessors bunny bunny.model kernel math
opengl.demo-support opengl.gl sequences ui.gadgets.worlds ;

M: bunny-world draw-world*
dup draw-seq>> empty?
[ drop ] [
0.15 0.15 0.15 1.0 glClearColor
GL_DEPTH_BUFFER_BIT GL_COLOR_BUFFER_BIT bitor glClear
dup demo-world-set-matrix GL_MODELVIEW glMatrixMode
0.02 -0.105 0.0 glTranslatef [ geom>> ] [ get-draw ] bi
draw-bunny
] if ;


USING: accessors bunny destructors kernel sequences
ui.gadgets.worlds ;

M: bunny-world end-world
dup find-gl-context
[ geom>> [ dispose ] when* ]
[ draw-seq>> [ [ dispose ] when* ] each ] bi ;