bin/ltpict.pl
author Axel Jacobs <axel@jaloxa.eu>
Tue, 15 Apr 2014 21:54:53 +0100
changeset 80 e97d9b1fb4f7
parent 79 0f5dabeed505
permissions -rw-r--r--
ltview: Run perltidy -ce
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 );
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    15
79
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    16
my $res     = 1024;     # Default output image dimensions. Same as objpict.
60
448b4b706fa5 ltpict: minor changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 58
diff changeset
    17
my $tiny    = 0.01;
79
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    18
my $maxsize = 0.001;    # max luminaire size after scaling
60
448b4b706fa5 ltpict: minor changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 58
diff changeset
    19
my $is_ies  = 0;
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    20
65
f10a54c3213d ltpict: IES input works now
Axel Jacobs <axel@jaloxa.eu>
parents: 60
diff changeset
    21
my $ies   = "$td/dist.ies";
79
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    22
my $lumi  = "$td/lumi.rad";     # Fitting given on cmd line, or generated by ies2rad
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    23
my $lumi2 = "$td/lumi2.rad";    # Fitting scaled to size
65
f10a54c3213d ltpict: IES input works now
Axel Jacobs <axel@jaloxa.eu>
parents: 60
diff changeset
    24
my $mat   = "$td/lt.mat";
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    25
my $room1 = "$td/room1.rad";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    26
my $room2 = "$td/room2.rad";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    27
my $room3 = "$td/room3.rad";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    28
my $room4 = "$td/room4.rad";
65
f10a54c3213d ltpict: IES input works now
Axel Jacobs <axel@jaloxa.eu>
parents: 60
diff changeset
    29
my $oct1  = "$td/lt1.oct";
f10a54c3213d ltpict: IES input works now
Axel Jacobs <axel@jaloxa.eu>
parents: 60
diff changeset
    30
my $oct2  = "$td/lt2.oct";
f10a54c3213d ltpict: IES input works now
Axel Jacobs <axel@jaloxa.eu>
parents: 60
diff changeset
    31
my $oct3  = "$td/lt3.oct";
f10a54c3213d ltpict: IES input works now
Axel Jacobs <axel@jaloxa.eu>
parents: 60
diff changeset
    32
my $oct4  = "$td/lt4.oct";
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    33
55
e00e7d28865e ltpict: Change default scale factor.
Axel Jacobs <axel@jaloxa.eu>
parents: 54
diff changeset
    34
# Parse command line arguments
65
f10a54c3213d ltpict: IES input works now
Axel Jacobs <axel@jaloxa.eu>
parents: 60
diff changeset
    35
while (@ARGV) {
79
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    36
    $_ = $ARGV[0];
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    37
    if (m/-i/) {    # File is an IES file, not a Radiance luminaire
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    38
        $is_ies = 1;
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    39
    } elsif (m/-d/) {    # Resolution of the output HDR image
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    40
        $res = $ARGV[1];
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    41
        shift @ARGV;
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    42
    } elsif (m/^-\w/) {    # Oops! Illegal option
65
f10a54c3213d ltpict: IES input works now
Axel Jacobs <axel@jaloxa.eu>
parents: 60
diff changeset
    43
        die("ltpict: bad option '$_'\n");
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    44
    } else {
79
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    45
        last;    # No more options.  What's left is the actual file name.
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    46
    }
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    47
    shift @ARGV;
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    48
}
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    49
68
67aa83bdbddd ltpict: Handle file names with spaces
Axel Jacobs <axel@jaloxa.eu>
parents: 65
diff changeset
    50
# We need exactly one Radiance luminaires or IES file
79
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    51
if ( !$#ARGV == 0 ) {
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    52
    die("ltpict: Need one Radiance luminaire or IES file.\n");
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    53
} elsif ( $is_ies == 0 ) {
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    54
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    55
    # Input file is a Radiance luminaire
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    56
    $lumi = $ARGV[0];
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    57
} else {
79
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    58
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    59
    # Input file is IES photometry
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    60
    system qq[ ies2rad -p $td -o lumi "$ARGV[0]" ];
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    61
}
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    62
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    63
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
    64
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    65
# Scale luminaire and center at origin
68
67aa83bdbddd ltpict: Handle file names with spaces
Axel Jacobs <axel@jaloxa.eu>
parents: 65
diff changeset
    66
my $dimstr = `getbbox -h "$lumi"`;
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    67
chomp $dimstr;
79
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    68
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    69
# Values returned by getbbox are indented and delimited with multiple spaces.
79
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    70
$dimstr =~ s/^\s+//;    # remove leading spaces
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    71
my @dims = split( /\s+/, $dimstr );    # convert to array
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    72
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    73
# Find largest axes-aligned dimension
79
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    74
my @diffs = ( $dims[1] - $dims[0], $dims[3] - $dims[2], $dims[5] - $dims[4] );
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    75
@diffs = reverse sort { $a <=> $b } @diffs;
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    76
my $size = $diffs[0];
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    77
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    78
# Move luminaire so centre is at origin, and scale
79
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    79
my $xtrans = -1.0 * ( $dims[0] + $dims[1] ) / 2;
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    80
my $ytrans = -1.0 * ( $dims[2] + $dims[3] ) / 2;
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    81
my $ztrans = -1.0 * ( $dims[4] + $dims[5] ) / 2;
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    82
my $scale  = $maxsize / $size;
68
67aa83bdbddd ltpict: Handle file names with spaces
Axel Jacobs <axel@jaloxa.eu>
parents: 65
diff changeset
    83
system qq[ xform -t $xtrans $ytrans $ztrans "$lumi" > $lumi2 ];
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    84
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    85
# Material for the room
79
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    86
open( FH, ">$mat" )
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    87
  or die("ltpict: Cannot write to temporary file $mat");
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    88
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
    89
close FH;
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    90
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    91
# Different 'room' geometry for different views
79
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    92
my $o = 0.1;    # Offset
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
    93
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    94
# C0-C180
79
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    95
open( FH, ">$room1" )
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    96
  or die("ltpict: Cannot write to temporary file $room1");
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    97
print FH
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
    98
  "wall_mat polygon box.4620  0  0  12  -$o -5 5  -$o 5 5  -$o 5 -5  -$o -5 -5";
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    99
close(FH);
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   100
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   101
# C90-C270
79
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
   102
open( FH, ">$room2" )
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
   103
  or die("ltpict: Cannot write to temporary file $room2");
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
   104
print FH
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
   105
  "wall_mat polygon box.1540  0  0  12  5 $o -5  5 $o 5  -5 $o 5  -5 $o -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
79
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
   109
open( FH, ">$room3" )
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
   110
  or die("ltpict: Cannot write to temporary file $room3");
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   111
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
   112
close(FH);
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   113
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   114
# Upper hemisphere
79
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
   115
open( FH, ">$room4" )
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
   116
  or die("ltpict: Cannot write to temporary file $room4");
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   117
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
   118
close(FH);
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   119
65
f10a54c3213d ltpict: IES input works now
Axel Jacobs <axel@jaloxa.eu>
parents: 60
diff changeset
   120
# Call bbox again, for the translated and scaled luminaire.
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   121
$dimstr = `getbbox -h $lumi2`;
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   122
chomp $dimstr;
79
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
   123
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   124
# Values returned by getbbox are indented and delimited with multiple spaces.
79
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
   125
$dimstr =~ s/^\s+//;    # remove leading spaces
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
   126
@dims = split( /\s+/, $dimstr );    # convert to array
68
67aa83bdbddd ltpict: Handle file names with spaces
Axel Jacobs <axel@jaloxa.eu>
parents: 65
diff changeset
   127
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   128
# Define the four views
79
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
   129
my $vw1    = "-vtl -vp 4.5 0 0 -vd -1 0 0 -vh 10 -vv 10";
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
   130
my $vw2    = "-vtl -vp 0 -4.5 0 -vd 0 1 0 -vh 10 -vv 10";
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   131
my $zcent3 = $dims[4] - $tiny;
79
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
   132
my $vw3    = "-vta -vp 0 0 $zcent3 -vd 0 0 -1 -vu 0 1 0 -vh 180 -vv 180";
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   133
my $zcent4 = $dims[5] + $tiny;
79
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
   134
my $vw4    = "-vta -vp 0 0 $zcent4 -vd 0 0 1 -vu 0 1 0 -vh 180 -vv 180";
68
67aa83bdbddd ltpict: Handle file names with spaces
Axel Jacobs <axel@jaloxa.eu>
parents: 65
diff changeset
   135
67aa83bdbddd ltpict: Handle file names with spaces
Axel Jacobs <axel@jaloxa.eu>
parents: 65
diff changeset
   136
# Compile octrees
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   137
system "oconv $mat $room1 $lumi2 > $oct1";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   138
system "oconv $mat $room2 $lumi2 > $oct2";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   139
system "oconv $mat $room3 $lumi2 > $oct3";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   140
system "oconv $mat $room4 $lumi2 > $oct4";
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   141
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   142
# Render four different views of the objects
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   143
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
   144
system "$rpict_cmd $vw1 $oct1 > $td/right.hdr";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   145
system "$rpict_cmd $vw2 $oct2 > $td/front.hdr";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   146
system "$rpict_cmd $vw3 $oct3 > $td/down.hdr";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   147
system "$rpict_cmd $vw4 $oct4 > $td/up.hdr";
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   148
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   149
# Compose the four views into one image
79
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
   150
my $vtl = "$td/vtl.hdr";    # The two parallel views
0f5dabeed505 ltpict: Run perltidy -ce
Axel Jacobs <axel@jaloxa.eu>
parents: 68
diff changeset
   151
my $vta = "$td/vta.hdr";    # The two fisheye views
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   152
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   153
# Auto-expose right/front and down/up pairs separately
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   154
my $pcond_cmd = "pcond -l";
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   155
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
   156
system "$pcond_cmd $td/rf.hdr > $vtl";
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   157
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
   158
system "$pcond_cmd $td/du.hdr > $vta";
259ce6d95331 ltpict: Minor changes for readability
Axel Jacobs <axel@jaloxa.eu>
parents: 55
diff changeset
   159
58
e4892d4ef026 ltpict: Minor readability changes.
Axel Jacobs <axel@jaloxa.eu>
parents: 56
diff changeset
   160
# 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
   161
exec "pcompos -a 1 $vtl $vta";
54
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   162
be2807ee7183 Working prototype of ltpict.pl
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   163
#EOF