Update examples after changing Shapes extension namespaces
[shapes.git] / examples / features / lightdemo.shape
blob0b920fd1c79c3dede5f31bdd42aa802d908d9622
1 /** This file is part of Shapes.
2  **
3  ** Shapes is free software: you can redistribute it and/or modify
4  ** it under the terms of the GNU General Public License as published by
5  ** the Free Software Foundation, either version 3 of the License, or
6  ** any later version.
7  **
8  ** Shapes is distributed in the hope that it will be useful,
9  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
10  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  ** GNU General Public License for more details.
12  **
13  ** You should have received a copy of the GNU General Public License
14  ** along with Shapes.  If not, see <http://www.gnu.org/licenses/>.
15  **
16  ** Copyright 2008, 2014, 2015 Henrik Tidefelt
17  **/
19 ##lookin Shapes
20 ##lookin Shapes..Layout
22 •zbuf: newZBuf
24 r: 10cm
25 ##unit w = 3.4cm
26 obj:
27     @nonstroking:[rgb 0.8 0 0]
28   & @reflections:[phong 1]
29   & @autointensity:[rgb 0 0.05 0]
30   & @autoscattering:[phong 0.2]
31   & @facetresolution:2cm
32   |
33   [facet (r,~5cm,~0.5w)--(r,5cm,~0.5w)--(r,5cm,0.5w)--(r,~5cm,0.5w)--cycle]
35 [[range 20° 360° 20°].foldsl
36  \ p e •st →
37   !{
38     •st << [rotate3D (0,1,0) ~e] [] obj
39     p
40   }
41  void
42  •zbuf]
44 •zbuf << [shift (6cm,6cm,20cm)] [] [specular_light [gray 0.9]]
45 •zbuf << [shift (~15cm,~3cm,20cm)] [] [specular_light [gray 0.3]]
46 •zbuf << [ambient_light [gray 0.1]]
48 zbuf: •zbuf;
50 tmp: [bboxed_enlarge [view [rotate3D (1,0,0) 20°]*[rotate3D (0,1,0) 1°] [] zbuf] (5mm,5mm)]
52 •page << @nonstroking:GRAY_BLACK | [fill [bbox tmp]]
53 •page << tmp