M: bunny-world begin-world
GL_DEPTH_TEST glEnable
0.0 0.0 0.375 set-demo-orientation
- maybe-download read-model
+ download-bunny read-model
[ >>model-triangles ] [ <bunny-geom> >>geom ] bi
dup make-draws >>draw-seq
0 >>draw-n
} set-gestures
MAIN-WINDOW: bunny-window {
- { world-class bunny-world }
- { title "Bunny" }
- { pixel-format-attributes {
- windowed
- double-buffered
- T{ depth-bits { value 16 } }
- } }
- { pref-dim { 640 480 } }
- } ;
+ { world-class bunny-world }
+ { title "Bunny" }
+ { pixel-format-attributes {
+ windowed
+ double-buffered
+ T{ depth-bits { value 16 } }
+ } }
+ { pref-dim { 640 480 } }
+} ;
: model-path ( -- path ) "bun_zipper.ply" cache-file ;
-: model-url ( -- url ) "http://duriansoftware.com/joe/media/bun_zipper.ply" ;
-
-: maybe-download ( -- path )
- model-path dup exists? [
- "Downloading bunny from " write
- model-url dup print flush
- over download-to
- ] unless ;
+CONSTANT: model-url "http://duriansoftware.com/joe/media/bun_zipper.ply"
+
+: download-bunny ( -- path )
+ model-url model-path [ ?download-to ] keep ;
:: (draw-triangle) ( ns vs triple -- )
triple [| elt |
CONSTANT: bunny-model-url "http://duriansoftware.com/joe/media/bun_zipper.ply"
: download-bunny ( -- path )
- bunny-model-path dup exists? [
- bunny-model-url dup print flush
- over download-to
- ] unless ;
+ bunny-model-url bunny-model-path [ ?download-to ] keep ;
: get-bunny-data ( bunny-state -- )
download-bunny bunny-data
deranged-anagrams [ first length ] sort-with last ;
: default-word-list ( -- path )
- "unixdict.txt" temp-file dup exists? [
- URL" http://puzzlers.org/pub/wordlists/unixdict.txt"
- over download-to
- ] unless ;
+ URL" http://puzzlers.org/pub/wordlists/unixdict.txt"
+ "unixdict.txt" temp-file [ ?download-to ] keep ;
: longest-deranged-anagrams ( -- anagrams )
default-word-list (longest-deranged-anagrams) ;
! this page.
MEMO: word-list ( -- seq )
- "unixdict.txt" temp-file dup exists? [
- URL" http://puzzlers.org/pub/wordlists/unixdict.txt"
- over download-to
- ] unless utf8 file-lines ;
+ URL" http://puzzlers.org/pub/wordlists/unixdict.txt"
+ "unixdict.txt" temp-file
+ [ ?download-to ] [ utf8 file-lines ] bi ;
: ordered-word? ( word -- ? )
>lower [ <= ] monotonic? ;