ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/fieldcomb.csh
Revision: 2.5
Committed: Mon Sep 5 16:13:08 2005 UTC (18 years, 7 months ago) by greg
Content type: application/x-csh
Branch: MAIN
Changes since 2.4: +10 -4 lines
Log Message:
Added -f option to output combined fields to a single frame

File Contents

# Content
1 #!/bin/csh -f
2 # RCSid $Id: fieldcomb.csh,v 2.4 2005/09/03 20:44:08 greg Exp $
3 #
4 # Combine alternate lines in full frames for field rendering
5 #
6 # Expects numbered frames on command line, as given by ranimate
7 #
8 # If an odd number of frames is provided, the spare frame at the
9 # end is linked to $spare_name for the next run
10 #
11 # Written by Greg Ward for Iebele Abel in August 2005
12 #
13 set spare_name=spare_fieldcomb_frame.pic
14 set odd_first=0
15 while ($#argv > 1)
16 switch ($argv[1])
17 case -r*:
18 set remove_orig
19 breaksw
20 case -o*:
21 set odd_first=1
22 breaksw
23 case -e*:
24 set odd_first=0
25 breaksw
26 case -f*:
27 shift argv
28 set outfile="$argv[1]"
29 breaksw
30 default:
31 if ("$argv[1]" !~ -*) break
32 echo "Unknown option: $argv[1]"
33 exit 1
34 endsw
35 shift argv
36 end
37 if ($#argv < 2 || ($?outfile && $#argv > 2)) then
38 echo "Usage: $0 [-e|-o][-r] [-f combined.pic] field1.pic field2.pic .."
39 exit 1
40 endif
41 set f1=$argv[1]:q
42 set ext=$f1:e
43 set basenm="`echo $f1:q | sed 's/[0-9]*\.'$ext'//'`"
44 set curfi=`echo $f1:q | sed 's/^[^1-9]*\(.[0-9]*\)\.'$ext'$/\1/'`
45 set fields=($argv[*]:q)
46 if (-r $spare_name) then
47 set fields=($spare_name $fields:q)
48 @ curfi--
49 endif
50 @ curfr = $curfi / 2
51 set curfi=1
52 while ($curfi < $#fields)
53 @ nextfi = $curfi + 1
54 if ($curfr < 10) then
55 set fid=000$curfr
56 else if ($curfr < 100) then
57 set fid=00$curfr
58 else if ($curfr < 1000) then
59 set fid=0$curfr
60 else
61 set fid=$curfr
62 endif
63 set outf="${basenm}C$fid.$ext"
64 if ($?outfile) set outf=$outfile:q
65 pcomb -e 'ro=ri(fld); go=gi(fld); bo=bi(fld)' \
66 -e 'yd=yres-1-y; odd=.5*yd-floor(.5*yd)-.25' \
67 -e "fld=if(odd,2-$odd_first,1+$odd_first)" \
68 $fields[$curfi]:q $fields[$nextfi]:q \
69 > $outf:q
70 if ($?remove_orig) rm $fields[$curfi]:q $fields[$nextfi]:q
71 @ curfr++
72 @ curfi = $nextfi + 1
73 end
74 rm -f $spare_name
75 if ($curfi == $#fields) ln "${basenm}$curfi.$ext" $spare_name