1 ! Copyright (C) 2008 Jeff Bigot
\r
2 ! See http://factorcode.org/license.txt for BSD license.
\r
15 IN: 4DNav.space-file-decoder
\r
17 : decode-number-array ( x -- y ) "," split [ string>number ] map ;
\r
19 PROCESS: adsoda-read-model ( tag -- )
\r
21 TAG: dimension adsoda-read-model children>> first string>number ;
\r
22 TAG: direction adsoda-read-model children>> first decode-number-array ;
\r
23 TAG: color adsoda-read-model children>> first decode-number-array ;
\r
24 TAG: name adsoda-read-model children>> first ;
\r
25 TAG: face adsoda-read-model children>> first decode-number-array ;
\r
27 TAG: solid adsoda-read-model
\r
30 [ "dimension" tag-named adsoda-read-model >>dimension ]
\r
31 [ "name" tag-named adsoda-read-model >>name ]
\r
32 [ "color" tag-named adsoda-read-model >>color ]
\r
33 [ "face" tags-named [ adsoda-read-model cut-solid ] each ]
\r
38 TAG: light adsoda-read-model
\r
41 [ "direction" tag-named adsoda-read-model >>direction ]
\r
42 [ "color" tag-named adsoda-read-model >>color ]
\r
46 TAG: space adsoda-read-model
\r
49 [ "dimension" tag-named adsoda-read-model >>dimension ]
\r
50 [ "name" tag-named adsoda-read-model >>name ]
\r
51 [ "color" tag-named adsoda-read-model >>ambient-color ]
\r
52 [ "solid" tags-named [ adsoda-read-model suffix-solids ] each ]
\r
53 [ "light" tags-named [ adsoda-read-model suffix-lights ] each ]
\r
57 : read-model-file ( path -- x )
\r
60 [ file>xml "space" tags-named first adsoda-read-model ]
\r
61 [ drop <space> ] recover
\r
62 ] [ drop <space> ] if
\r