… | |
… | |
3 | use Storable qw/dclone/; |
3 | use Storable qw/dclone/; |
4 | use Math::Trig; |
4 | use Math::Trig; |
5 | use XML::Parser; |
5 | use XML::Parser; |
6 | use XML::Writer; |
6 | use XML::Writer; |
7 | use Cwd; |
7 | use Cwd; |
8 | use Math::VectorReal; |
|
|
9 | $Math::VectorReal::FORMAT = "x=\"%1.3f\" y=\"%1.3f\" z=\"%1.3f\""; |
|
|
10 | use File::Spec::Functions; |
8 | use File::Spec::Functions; |
11 | use strict; |
9 | use strict; |
12 | |
10 | |
13 | our $DEBUG = 0; |
11 | our $DEBUG = 0; |
14 | |
12 | |
… | |
… | |
239 | ); |
237 | ); |
240 | }; |
238 | }; |
241 | |
239 | |
242 | |
240 | |
243 | my ($w, $h) = ($cfg->{w}, $cfg->{h} || $cfg->{w}); |
241 | my ($w, $h) = ($cfg->{w}, $cfg->{h} || $cfg->{w}); |
244 | my $to = vector (0, 0, 0); |
242 | my @to = (0, 0, 0); |
245 | my $from = vector (0, 0, $cfg->{height}); |
243 | my @from = (0, 0, $cfg->{height}); |
246 | my $up = vector (0, 1, 0)->norm; |
244 | my @up = (0, 1, 0); |
247 | $up = $from + $up; |
245 | @up = map { $up[$_] + $from[$_] } 0..2; |
248 | |
246 | |
249 | add_tags ($tree, |
247 | add_tags ($tree, |
250 | light => [ |
248 | light => [ |
251 | { type => 'sunlight', name => 'w_Infinite', power => "0.5", |
249 | { type => 'sunlight', name => 'w_Infinite', power => "0.5", |
252 | cast_shadows => "off" |
250 | cast_shadows => "off" |
… | |
… | |
267 | add_tags ($tree, |
265 | add_tags ($tree, |
268 | camera => [ |
266 | camera => [ |
269 | { name => "xcam", resx => $w, resy => $h, focal => "10", |
267 | { name => "xcam", resx => $w, resy => $h, focal => "10", |
270 | type => "ortho" }, |
268 | type => "ortho" }, |
271 | to => [{ x => 0, y => 0, z => 0 }], |
269 | to => [{ x => 0, y => 0, z => 0 }], |
272 | from => [{ x => 0, y => $from->y, z => $from->z }], |
270 | from => [{ x => 0, y => $from[1], z => $from[2] }], |
273 | up => [{ x => $up->x, y => $up->y, z => $up->z }], |
271 | up => [{ x => $up[0], y => $up[1], z => $up[2] }], |
274 | ], |
272 | ], |
275 | render => [ |
273 | render => [ |
276 | { camera_name => "xcam", raydepth => "4", |
274 | { camera_name => "xcam", raydepth => "4", |
277 | gamma => "1", |
275 | gamma => "1", |
278 | exposure => "0", save_alpha => "on", |
276 | exposure => "0", save_alpha => "on", |