ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/fieldcomb.csh
Revision: 2.1
Committed: Fri Sep 2 04:15:42 2005 UTC (18 years, 7 months ago) by greg
Content type: application/x-csh
Branch: MAIN
Log Message:
Created fieldcomb script to combine alternate fields in walk-through animations

File Contents

# User Rev Content
1 greg 2.1 #!/bin/csh -f
2     #
3     # Combine alternate lines in full frames for field rendering
4     #
5     # Expects numbered frames on command line, as given by ranimate
6     #
7     # If an odd number of frames is provided, the spare frame at the
8     # end is linked to $spare_name for the next run
9     #
10     # Written by Greg Ward for Iebele Atelier in August 2005
11     #
12     set spare_name=spare_fieldcomb_frame.pic
13     if ($#argv > 1) then
14     if ("$argv[1]" == "-r") then
15     set remove_orig
16     shift argv
17     endif
18     endif
19     if ($#argv < 2) then
20     echo "Usage: $0 [-r] field1.pic field2.pic .."
21     exit 1
22     endif
23     set f1=$argv[1]:q
24     set ext=$f1:e
25     set basenm="`echo $f1:q | sed 's/[0-9]*\.'$ext'//'`"
26     set curfi=`echo $f1:q | sed 's/^[^1-9]*\(.[0-9]*\)\.'$ext'$/\1/'`
27     set fields=($argv[*]:q)
28     if (-r $spare_name) then
29     set fields=($spare_name $fields:q)
30     @ curfi--
31     endif
32     @ curfr = $curfi / 2
33     set curfi=1
34     while ($curfi < $#fields)
35     @ nextfi = $curfi + 1
36     pcomb -e 'ro=ri(fld);go=gi(fld);bo=bi(fld)' \
37     -e 'odd=.5*y-floor(.5*y)-.25' -e 'fld=if(odd,1,2)' \
38     $fields[$curfi]:q $fields[$nextfi]:q \
39     > "${basenm}C$curfr.$ext"
40     if ($?remove_orig) rm $fields[$curfi]:q $fields[$nextfi]:q
41     @ curfr++
42     @ curfi = $nextfi + 1
43     end
44     rm -f $spare_name
45     if ($curfi == $#fields) ln "${basenm}$curfi.$ext" $spare_name