M: bunny-gadget graft* ( gadget -- )
GL_DEPTH_TEST glEnable
- dup bunny-gadget-model <bunny-geom>
- over {
- [ <bunny-fixed-pipeline> ]
- [ <bunny-cel-shaded> ]
- [ <bunny-outlined> ]
- } map-call-with [ ] filter
- 0
- roll {
- set-bunny-gadget-geom
- set-bunny-gadget-draw-seq
- set-bunny-gadget-draw-n
- } set-slots ;
+ dup model>> <bunny-geom> >>geom
+ dup
+ [ <bunny-fixed-pipeline> ]
+ [ <bunny-cel-shaded> ]
+ [ <bunny-outlined> ] tri 3array
- [ ] subset >>draw-seq
++ [ ] filter >>draw-seq
+ 0 >>draw-n
+ drop ;
M: bunny-gadget ungraft* ( gadget -- )
- { bunny-gadget-geom bunny-gadget-draw-seq } get-slots
- [ [ dispose ] when* ] each
- [ dispose ] when* ;
+ [ geom>> [ dispose ] when* ]
+ [ draw-seq>> [ [ dispose ] when* ] each ] bi ;
M: bunny-gadget draw-gadget* ( gadget -- )
0.15 0.15 0.15 1.0 glClearColor
- USING: arrays combinators.lib kernel math math.functions math.vectors namespaces
- opengl opengl.gl sequences ui ui.gadgets ui.gestures ui.render accessors ;
+ USING: arrays combinators.lib kernel math math.functions
+ math.order math.vectors namespaces opengl opengl.gl sequences ui
+ ui.gadgets ui.gestures ui.render ;
IN: opengl.demo-support
-: NEAR-PLANE 1.0 64.0 / ; inline
-: FAR-PLANE 4.0 ; inline
: FOV 2.0 sqrt 1+ ; inline
: MOUSE-MOTION-SCALE 0.5 ; inline
-: MOUSE-DISTANCE-SCALE 1.0 64.0 / ; inline
: KEY-ROTATE-STEP 1.0 ; inline
-: KEY-DISTANCE-STEP 1.0 64.0 / ; inline
-: DIMS { 640 480 } ; inline
-
-: FOV-RATIO ( -- fov ) DIMS dup first2 min v/n ;
SYMBOL: last-drag-loc