… | |
… | |
160 | |
160 | |
161 | my $tree = $p->parse ($cont); |
161 | my $tree = $p->parse ($cont); |
162 | |
162 | |
163 | my $a = 0; |
163 | my $a = 0; |
164 | |
164 | |
165 | if ($dir_n == 0 || $dir_n == 1) { |
165 | my %dir_to_degree = ( |
166 | $a = 0; |
166 | # 5 => 0, |
167 | } elsif ($dir_n == 2) { |
167 | # 5 => 0, |
168 | $a = 45; |
168 | # 6 => 45, |
169 | } elsif ($dir_n == 3) { |
169 | # 7 => 90, |
170 | $a = 90; |
170 | # 8 => 135, |
171 | } elsif ($dir_n == 4) { |
171 | # 1 => 180, |
172 | $a = 90 + 45; |
172 | # 2 => 225, |
173 | } elsif ($dir_n == 5) { |
173 | # 3 => 270, |
174 | $a = 180; |
174 | # 4 => 315 |
175 | } elsif ($dir_n == 6) { |
175 | 0 => 0, |
176 | $a = 180 + 45; |
176 | 1 => 0, |
177 | } elsif ($dir_n == 7) { |
177 | 2 => 45, |
178 | $a = 270; |
178 | 3 => 90, |
179 | } elsif ($dir_n == 8) { |
179 | 4 => 135, |
180 | $a = 270 + 45; |
180 | 5 => 180, |
181 | } |
181 | 6 => 225, |
|
|
182 | 7 => 270, |
|
|
183 | 8 => 315 |
|
|
184 | ); |
|
|
185 | $a = $dir_to_degree{$dir_n}; |
182 | $a = deg2rad - $a; # -$a because we want a clockwise rotation |
186 | $a = deg2rad - $a; # -$a because we want a clockwise rotation |
183 | |
187 | |
184 | remove_tags ($tree, qw/light render camera background/); |
188 | remove_tags ($tree, qw/light render camera background/); |
185 | filter_tags ($tree, |
189 | filter_tags ($tree, |
186 | object => sub { |
190 | object => sub { |
… | |
… | |
242 | my @to = (0, 0, 0); |
246 | my @to = (0, 0, 0); |
243 | my @from = (0, 0, $cfg->{height}); |
247 | my @from = (0, 0, $cfg->{height}); |
244 | my @up = (0, 1, 0); |
248 | my @up = (0, 1, 0); |
245 | @up = map { $up[$_] + $from[$_] } 0..2; |
249 | @up = map { $up[$_] + $from[$_] } 0..2; |
246 | |
250 | |
|
|
251 | my $power_offs = $cfg->{power_offs} || 0; |
|
|
252 | |
247 | add_tags ($tree, |
253 | add_tags ($tree, |
248 | light => [ |
254 | light => [ |
249 | { type => 'sunlight', name => 'w_Infinite', power => "0.5", |
255 | { type => 'sunlight', name => 'w_Infinite', power => sprintf ("%1.1f", 0.5 + $power_offs), |
250 | cast_shadows => "off" |
256 | cast_shadows => "off" |
251 | }, |
257 | }, |
252 | from => [{ x => -1, y => 1, z => 0.7 }], |
258 | from => [{ x => -1, y => 1, z => 0.7 }], |
253 | color => [{ r => 1, g => 1, b => 1 }] |
259 | color => [{ r => 1, g => 1, b => 1 }] |
254 | ] |
260 | ] |
255 | ); |
261 | ); |
256 | add_tags ($tree, |
262 | add_tags ($tree, |
257 | light => [ |
263 | light => [ |
258 | { type => 'sunlight', name => 'w_Infinite2', power => "1", |
264 | { type => 'sunlight', name => 'w_Infinite2', power => sprintf ("%1.1f", 1 + $power_offs), |
259 | cast_shadows => "off" |
265 | cast_shadows => "off" |
260 | }, |
266 | }, |
261 | from => [{ x => 1, y => -1, z => 0.7 }], |
267 | from => [{ x => 1, y => -1, z => 0.7 }], |
262 | color => [{ r => 1, g => 1, b => 1 }] |
268 | color => [{ r => 1, g => 1, b => 1 }] |
263 | ] |
269 | ] |
… | |
… | |
271 | up => [{ x => $up[0], y => $up[1], z => $up[2] }], |
277 | up => [{ x => $up[0], y => $up[1], z => $up[2] }], |
272 | ], |
278 | ], |
273 | render => [ |
279 | render => [ |
274 | { camera_name => "xcam", raydepth => "4", |
280 | { camera_name => "xcam", raydepth => "4", |
275 | gamma => "1", |
281 | gamma => "1", |
276 | exposure => "0", save_alpha => "on", |
282 | exposure => ($cfg->{exposure} || "0"), save_alpha => "on", |
277 | AA_passes => "1", |
283 | AA_passes => "2", |
278 | bias => "0.1", AA_threshold => "0", AA_minsamples => "4", |
284 | bias => "0.1", AA_threshold => "0", AA_minsamples => "16", |
279 | AA_pixelwidth => "1.25", AA_jitterfirst => "off", |
285 | AA_pixelwidth => "1.25", AA_jitterfirst => "off", |
280 | clamp_rgb => "on" |
286 | clamp_rgb => "on" |
281 | }, |
287 | }, |
282 | outfile => [{ value => $outfile }], |
288 | outfile => [{ value => $outfile }], |
283 | ] |
289 | ] |