equal
deleted
inserted
replaced
5 # |
5 # |
6 # This is a re-write of Greg's original objview.csh. |
6 # This is a re-write of Greg's original objview.csh. |
7 # The only extra functionality is that we accept a scene on STDIN |
7 # The only extra functionality is that we accept a scene on STDIN |
8 # if no file name is given. |
8 # if no file name is given. |
9 # |
9 # |
10 # Axel, Oct 2010 |
10 # Axel, Nov 2013 |
11 |
11 |
12 use strict; |
12 use strict; |
13 use warnings; |
13 use warnings; |
14 use File::Temp qw/ tempdir /; |
14 use File::Temp qw/ tempdir /; |
15 |
15 |
29 my $glradopt = 0; # An option specific to glrad was passed (Boolean). |
29 my $glradopt = 0; # An option specific to glrad was passed (Boolean). |
30 |
30 |
31 while (@ARGV) { |
31 while (@ARGV) { |
32 $_ = $ARGV[0]; |
32 $_ = $ARGV[0]; |
33 if (m/-g/) { # OpenGL output |
33 if (m/-g/) { # OpenGL output |
|
34 if ( $^O =~ /MSWin32/ ) { |
|
35 die("OpenGL view is not available under Windows.\n"); |
|
36 } |
34 $usegl = 1; |
37 $usegl = 1; |
35 } elsif (m/-u/) { # up direction |
38 } elsif (m/-u/) { # up direction |
36 $up = $ARGV[1]; |
39 $up = $ARGV[1]; |
37 shift @ARGV; |
40 shift @ARGV; |
38 } elsif ((m/-s/) or (m/-w/)) { # silent, no warnings |
41 } elsif ((m/-s/) or (m/-w/)) { # silent, no warnings |
78 } |
81 } |
79 |
82 |
80 # Make sure we don't confuse glrad and rad options. |
83 # Make sure we don't confuse glrad and rad options. |
81 if ($usegl) { |
84 if ($usegl) { |
82 if ($radopt) { |
85 if ($radopt) { |
83 #system "glrad"; # Why are we launching glrad anyhow? |
|
84 die("objview: glrad output requested, but rad option passed.\n"); |
86 die("objview: glrad output requested, but rad option passed.\n"); |
85 } |
87 } |
86 } else { |
88 } else { |
87 if ($glradopt) { |
89 if ($glradopt) { |
88 #system "rad"; |
|
89 die("objview: rad output requested, but glrad option passed.\n"); |
90 die("objview: rad output requested, but glrad option passed.\n"); |
90 } |
91 } |
91 } |
92 } |
92 |
93 |
93 open(FH, ">$lights") or |
94 open(FH, ">$lights") or |
100 bright source sun2 0 0 4 .3 1 1 5 |
101 bright source sun2 0 0 4 .3 1 1 5 |
101 bright source sun3 0 0 4 -1 -.7 1 5 |
102 bright source sun3 0 0 4 -1 -.7 1 5 |
102 EndOfLights |
103 EndOfLights |
103 close(FH); |
104 close(FH); |
104 |
105 |
105 my $scenes = join(' ', @ARGV) . " $lights"; |
106 my @scenes = @ARGV; |
|
107 push (@scenes, $lights); |
|
108 |
|
109 # Make this work under Windoze |
|
110 if ( $^O =~ /MSWin32/ ) { |
|
111 for my $i (0 .. $#scenes) { |
|
112 # rad doesn't like Windows-style backslashes. |
|
113 $scenes[$i] =~ s{\\}{/}g; |
|
114 } |
|
115 $octree =~ s{\\}{/}g; |
|
116 $ambf =~ s{\\}{/}g; |
|
117 $raddev = "qt"; |
|
118 } |
|
119 |
|
120 my $scene = join(' ', @scenes); |
106 open(FH, ">$rif") or |
121 open(FH, ">$rif") or |
107 die("objview: Can't write to temporary file $rif\n"); |
122 die("objview: Can't write to temporary file $rif\n"); |
108 print FH <<EndOfRif; |
123 print FH <<EndOfRif; |
109 scene= $scenes |
124 scene= $scene |
110 EXPOSURE= .5 |
125 EXPOSURE= .5 |
111 UP= $up |
126 UP= $up |
112 view= $vw |
127 view= $vw |
113 OCTREE= $octree |
128 OCTREE= $octree |
114 oconv= -f |
129 oconv= -f |