equal
deleted
inserted
replaced
3 # Make a nice multi-view picture of a luminaire |
3 # Make a nice multi-view picture of a luminaire |
4 # |
4 # |
5 # This is based on objpict.pl that renders four-view |
5 # This is based on objpict.pl that renders four-view |
6 # images of objects that are not light sources. |
6 # images of objects that are not light sources. |
7 # |
7 # |
8 # Written by Axel Jacobs, |
8 # Written by Axel Jacobs |
9 # with input from Rob Guglielmetti and Gre |
|
10 |
9 |
11 use strict; |
10 use strict; |
12 use warnings; |
11 use warnings; |
13 |
12 |
14 use File::Temp qw/ tempdir /; |
13 use File::Temp qw/ tempdir /; |
20 my $xres = 600; |
19 my $xres = 600; |
21 my $yres = 600; |
20 my $yres = 600; |
22 my $tiny = 0.01; |
21 my $tiny = 0.01; |
23 my $is_ies = 0; |
22 my $is_ies = 0; |
24 my $rpict_cmd = "rpict -ab 0 -ds 0 -dv -av 0 0 0 -x $xres -y $yres"; |
23 my $rpict_cmd = "rpict -ab 0 -ds 0 -dv -av 0 0 0 -x $xres -y $yres"; |
25 my $pfilt_cmd = "pfilt -r .6 -x /2 -y /2"; |
24 my $pcond_cmd = "pcond -l"; |
26 |
25 |
27 my $ies = "$td/dist.ies"; |
26 my $ies = "$td/dist.ies"; |
28 my $fittings = "$td/fitting.rad"; |
27 my $fittings = "$td/fitting.rad"; |
29 my $material = "$td/lt.mat"; |
28 my $material = "$td/lt.mat"; |
30 my $testroom1 = "$td/testroom1.rad"; |
29 my $testroom1 = "$td/testroom1.rad"; |
86 close FH; |
85 close FH; |
87 |
86 |
88 |
87 |
89 # Different 'room' geometry for different views |
88 # Different 'room' geometry for different views |
90 my $OFFSET = 0.1; |
89 my $OFFSET = 0.1; |
91 open(FH, ">$testroom1") or die("Can\'t write to temporary file $testroom1"); |
90 open(FH, ">$testroom1") or die("Can't write to temporary file $testroom1"); |
92 # C0-C180 |
91 # C0-C180 |
93 print FH "wall_mat polygon box.4620 0 0 12 -$OFFSET -5 5 -$OFFSET 5 5 -$OFFSET 5 -5 -$OFFSET -5 -5"; |
92 print FH "wall_mat polygon box.4620 0 0 12 -$OFFSET -5 5 -$OFFSET 5 5 -$OFFSET 5 -5 -$OFFSET -5 -5"; |
94 close(FH); |
93 close(FH); |
95 |
94 |
96 open(FH, ">$testroom2") or die("Can\'t write to temporary file $testroom2"); |
95 open(FH, ">$testroom2") or die("Can't write to temporary file $testroom2"); |
97 # C90-C270 |
96 # C90-C270 |
98 print FH "wall_mat polygon box.1540 0 0 12 5 $OFFSET -5 5 $OFFSET 5 -5 $OFFSET 5 -5 $OFFSET -5"; |
97 print FH "wall_mat polygon box.1540 0 0 12 5 $OFFSET -5 5 $OFFSET 5 -5 $OFFSET 5 -5 $OFFSET -5"; |
99 close(FH); |
98 close(FH); |
100 |
99 |
101 open(FH, ">$testroom3") or die("Can\'t write to temporary file $testroom3"); |
100 open(FH, ">$testroom3") or die("Can't write to temporary file $testroom3"); |
102 # Lower hemisphere |
101 # Lower hemisphere |
103 print FH "wall_mat bubble lower 0 0 4 0 0 $dims[4] 5"; |
102 print FH "wall_mat bubble lower 0 0 4 0 0 $dims[4] 5"; |
104 close(FH); |
103 close(FH); |
105 |
104 |
106 open(FH, ">$testroom4") or die("Can\'t write to temporary file $testroom4"); |
105 open(FH, ">$testroom4") or die("Can't write to temporary file $testroom4"); |
107 # Upper hemisphere |
106 # Upper hemisphere |
108 print FH "wall_mat bubble upper 0 0 4 0 0 $dims[5] 5"; |
107 print FH "wall_mat bubble upper 0 0 4 0 0 $dims[5] 5"; |
109 close(FH); |
108 close(FH); |
110 |
109 |
111 |
110 |
139 my $cmd; |
138 my $cmd; |
140 my $vtl = "$td/vtl.hdr"; |
139 my $vtl = "$td/vtl.hdr"; |
141 my $vta = "$td/vta.hdr"; |
140 my $vta = "$td/vta.hdr"; |
142 |
141 |
143 # Auto-expose right/front and down/up pairs separately |
142 # Auto-expose right/front and down/up pairs separately |
144 system "pcompos $td/right.hdr 0 0 $td/front.hdr $xres 0 |$pfilt_cmd > $vtl"; |
143 system "pcompos $td/right.hdr 0 0 $td/front.hdr $xres 0 > $td/rf.hdr"; |
145 system "pcompos $td/down.hdr 0 0 $td/up.hdr $xres 0 |$pfilt_cmd > $vta"; |
144 system "$pcond_cmd $td/rf.hdr > $vtl"; |
146 my $yres2 = $yres / 2; |
145 system "pcompos $td/down.hdr 0 0 $td/up.hdr $xres 0 > $td/du.hdr"; |
147 exec "pcompos $vtl 0 0 $vta 0 $yres2"; |
146 system "$pcond_cmd $td/du.hdr > $vta"; |
|
147 |
|
148 # Combine top two images with bottom row |
|
149 exec "pcompos -a 1 $vtl $vta"; |
148 |
150 |
149 #EOF |
151 #EOF |