bin/ltpict.pl
author Axel Jacobs <axel@jaloxa.eu>
Mon, 10 Mar 2014 20:16:57 +0000
changeset 58 e4892d4ef026
parent 56 259ce6d95331
child 60 448b4b706fa5
permissions -rwxr-xr-x
ltpict: Minor readability changes.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
     1
#!/usr/bin/perl
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
     2
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
     3
# Make a four-view picture of the photometry of a luminaire
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
     4
#
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
     5
# This is inspired by objpict.pl that renders four-view
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
     6
# images of objects that are not light sources.
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
     7
#
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
     8
# Written by Axel Jacobs <axel@jaloxa.eu>
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
     9
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    10
use strict;
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    11
use warnings;
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    12
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    13
use File::Temp qw/ tempdir /;
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    14
my $td = tempdir( CLEANUP => 1 );
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    15
use File::Copy qw(copy);
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    16
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    17
my $res = 1024;                # Default output image dimensions
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    18
my $tiny = 0.01;
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    19
my $maxsize = 0.001;           # max luminaire size after scaling
55
e00e7d28865e ltpict: Change default scale factor.
Axel Jacobs <axel@jaloxa.eu>
parents: 54
diff changeset
    20
my $is_ies = 0;
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    21
55
e00e7d28865e ltpict: Change default scale factor.
Axel Jacobs <axel@jaloxa.eu>
parents: 54
diff changeset
    22
my $ies = "$td/dist.ies";
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    23
my $lumi = "$td/lumi.rad";     # Fitting as given on cmd line, or as generated by ies2rad
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    24
my $lumi2 = "$td/lumi2.rad";   # Fitting scaled to size
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    25
my $mat = "$td/lt.mat";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    26
my $room1 = "$td/room1.rad";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    27
my $room2 = "$td/room2.rad";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    28
my $room3 = "$td/room3.rad";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    29
my $room4 = "$td/room4.rad";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    30
my $oct1 = "$td/lt1.oct";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    31
my $oct2 = "$td/lt2.oct";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    32
my $oct3 = "$td/lt3.oct";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    33
my $oct4 = "$td/lt4.oct";
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    34
55
e00e7d28865e ltpict: Change default scale factor.
Axel Jacobs <axel@jaloxa.eu>
parents: 54
diff changeset
    35
# Parse command line arguments
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    36
while ($#ARGV >= 0) {
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    37
	$_ = $ARGV[0];
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    38
	if (m/-i/) {         # File is an IES file, not Radiance luminaire
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    39
		$is_ies = 1;
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    40
	} elsif (m/-d/) {    # Resolution of the output HDR image
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    41
		$res = $ARGV[1];
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    42
		shift @ARGV;
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    43
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    44
    } elsif (m/^-/) { 	 # Oops! Illegal option
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    45
        die("ltpict: bad option \"$ARGV[0]\"\n");
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    46
    } else {
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    47
		last;    # No more options.  What's left is the actual file name.
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    48
	}
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    49
    shift @ARGV;
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    50
}
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    51
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    52
# We need one Radiance luminaire or an IES file
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    53
if ($is_ies == 0) {
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    54
	# Input file is a Radiance luminaire
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    55
	copy $ARGV[0], $lumi or
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    56
			die("ltpict: Cannot copy file '$ARGV[0]' to $lumi\n");
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    57
} else {
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    58
	# Input file is IES photometry
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    59
	system "ies2rad -p $td -o lumi $ARGV[0]";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    60
}
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    61
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    62
my $res2 = $res / 2;    # Each rendering is half the size of final composite
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    63
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    64
# Scale luminaire and center at origin
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    65
my $dimstr = `getbbox -h $lumi`;
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    66
chomp $dimstr;
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    67
# Values returned by getbbox are indented and delimited with multiple spaces.
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    68
$dimstr =~ s/^\s+//;                # remove leading spaces
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    69
my @dims = split(/\s+/, $dimstr);   # convert to array
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    70
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    71
# Find largest axes-aligned dimension
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    72
my @diffs = ($dims[1]-$dims[0], $dims[3]-$dims[2], $dims[5]-$dims[4]);
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    73
@diffs = reverse sort { $a <=> $b } @diffs;
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    74
my $size = $diffs[0];
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    75
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    76
# Move luminaire so centre is at origin, and scale
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    77
my $xtrans = -1.0 * ($dims[0] + $dims[1]) / 2;
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    78
my $ytrans = -1.0 * ($dims[2] + $dims[3]) / 2;
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    79
my $ztrans = -1.0 * ($dims[4] + $dims[5]) / 2;
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    80
my $scale = $maxsize / $size;
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    81
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    82
open(FH, ">$lumi2") or
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    83
		die("ltpict: Cannot write to temporary file $lumi");
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    84
print FH "!xform -t $xtrans $ytrans $ztrans -s $scale $lumi";
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    85
close FH;
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    86
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    87
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    88
# Material for the room
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    89
open(FH, ">$mat") or
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    90
		die("ltpict: Cannot write to temporary file $mat");
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    91
print FH "void plastic wall_mat  0  0  5  .5 .5 .5  0 0";
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    92
close FH;
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    93
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    94
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    95
# Different 'room' geometry for different views
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    96
my $offset = 0.1;
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    97
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    98
# C0-C180
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    99
open(FH, ">$room1") or die("ltpict: Cannot write to temporary file $room1");
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   100
print FH "wall_mat polygon box.4620  0  0  12  -$offset -5 5  -$offset 5 5  -$offset 5 -5  -$offset -5 -5";
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   101
close(FH);
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   102
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   103
# C90-C270
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   104
open(FH, ">$room2") or die("ltpict: Cannot write to temporary file $room2");
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   105
print FH "wall_mat polygon box.1540  0  0  12  5 $offset -5  5 $offset 5  -5 $offset 5  -5 $offset -5";
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   106
close(FH);
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   107
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   108
# Lower hemisphere
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   109
open(FH, ">$room3") or die("ltpict: Cannot write to temporary file $room3");
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   110
print FH "wall_mat bubble lower  0  0  4 0 0 $dims[4] 5";
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   111
close(FH);
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   112
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   113
# Upper hemisphere
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   114
open(FH, ">$room4") or die("ltpict: Cannot write to temporary file $room4");
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   115
print FH "wall_mat bubble upper  0  0  4 0 0 $dims[5] 5";
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   116
close(FH);
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   117
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   118
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   119
# Get bbox again, for the translated and scaled luminaire.
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   120
$dimstr = `getbbox -h $lumi2`;
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   121
chomp $dimstr;
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   122
# Values returned by getbbox are indented and delimited with multiple spaces.
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   123
$dimstr =~ s/^\s+//;   # remove leading spaces
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   124
@dims = split(/\s+/, $dimstr);   # convert to array
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   125
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   126
# Define the four views
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   127
my $vw1 = "-vtl -vp 4.5 0 0 -vd -1 0 0 -vh 10 -vv 10";
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   128
my $vw2 = "-vtl -vp 0 -4.5 0 -vd 0 1 0 -vh 10 -vv 10";
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   129
my $zcent3 = $dims[4] - $tiny;
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   130
my $vw3 = "-vta -vp 0 0 $zcent3 -vd 0 0 -1 -vu 0 1 0 -vh 180 -vv 180";
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   131
my $zcent4 = $dims[5] + $tiny;
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   132
my $vw4 = "-vta -vp 0 0 $zcent4 -vd 0 0 1 -vu 0 1 0 -vh 180 -vv 180";
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   133
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   134
system "oconv $mat $room1 $lumi2 > $oct1";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   135
system "oconv $mat $room2 $lumi2 > $oct2";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   136
system "oconv $mat $room3 $lumi2 > $oct3";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   137
system "oconv $mat $room4 $lumi2 > $oct4";
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   138
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   139
# Render four different views of the objects
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   140
my $rpict_cmd = "rpict -ab 0 -ds 0 -dv -av 0 0 0 -x $res2 -y $res2";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   141
system "$rpict_cmd $vw1 $oct1 > $td/right.hdr";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   142
system "$rpict_cmd $vw2 $oct2 > $td/front.hdr";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   143
system "$rpict_cmd $vw3 $oct3 > $td/down.hdr";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   144
system "$rpict_cmd $vw4 $oct4 > $td/up.hdr";
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   145
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   146
# Compose the four views into one image
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   147
my $vtl = "$td/vtl.hdr";     # The two parallel views
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   148
my $vta = "$td/vta.hdr";     # The two fisheye views
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   149
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   150
# Auto-expose right/front and down/up pairs separately
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   151
my $pcond_cmd = "pcond -l";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   152
system "pcompos -a 2 $td/right.hdr  $td/front.hdr > $td/rf.hdr";
56
259ce6d95331 ltpict: Minor changes for readability
Axel Jacobs <axel@jaloxa.eu>
parents: 55
diff changeset
   153
system "$pcond_cmd $td/rf.hdr > $vtl";
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   154
system "pcompos -a 2 $td/down.hdr $td/up.hdr > $td/du.hdr";
56
259ce6d95331 ltpict: Minor changes for readability
Axel Jacobs <axel@jaloxa.eu>
parents: 55
diff changeset
   155
system "$pcond_cmd $td/du.hdr > $vta";
259ce6d95331 ltpict: Minor changes for readability
Axel Jacobs <axel@jaloxa.eu>
parents: 55
diff changeset
   156
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   157
# Combine top two images with bottom row.  Output HDR.
56
259ce6d95331 ltpict: Minor changes for readability
Axel Jacobs <axel@jaloxa.eu>
parents: 55
diff changeset
   158
exec "pcompos -a 1 $vtl $vta";
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   159
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   160
#EOF