--- ray/src/util/glare.csh 1991/05/03 10:06:06 1.8 +++ ray/src/util/glare.csh 2003/02/22 02:07:30 2.4 @@ -1,5 +1,5 @@ #!/bin/csh -f -# SCCSid "$SunId$ LBL" +# RCSid: $Id: glare.csh,v 2.4 2003/02/22 02:07:30 greg Exp $ # # Interactive program for calculating glare values # @@ -7,10 +7,15 @@ set fgargs=(-v) set nofile="none" set octree=$nofile set picture=$nofile +set glarefile=$nofile if ($#argv >= 1) then set glarefile=$argv[1] -else - set glarefile=$nofile + if ($#argv >= 2) then + set picture=$argv[2] + if ($#argv >= 3) then + set octree=$argv[3] + endif + endif endif set rtargs= set view= @@ -55,8 +60,12 @@ so the view specification is optional unless you are s octree. _EOF_ - readvar picture - readvar octree + if ( $picture == $nofile ) then + readvar picture + endif + if ( $octree == $nofile ) then + readvar octree + endif readvar view if ( $picture == $nofile && $octree == $nofile ) then echo "You must specify a picture or an octree" @@ -71,7 +80,10 @@ _EOF_ echo "Cannot read $picture" exit 1 endif - set fgargs=($fgargs -p $picture -vf $picture) + set fgargs=($fgargs -p $picture) + if ( "$view" != "" ) then + set view=(-vf $picture $view) + endif endif set fgargs=($fgargs $view) if ( $octree != $nofile ) then @@ -85,6 +97,10 @@ With an octree, you should give the same options for - so forth as are used to render the scene. Please enter them below. _EOF_ + if ($picture != $nofile) then + echo "These are the parameters from the picture:" + getinfo $picture + endif readvar rtargs set fgargs=($fgargs $rtargs $octree) endif @@ -131,23 +147,20 @@ _EOF_ echo "Starting calculation..." echo findglare $fgargs findglare $fgargs > $glarefile + if ($status) then + echo "Uh-oh. Something went wrong with findglare\!" + rm $glarefile + exit 1 + endif endif if ($?DISPLAY && $picture != $nofile) then echo "" echo "Displaying glare sources in '$picture'..." - xglaresrc $picture $glarefile >& /dev/null - if ($status == 2) then - echo "Starting ximage..." - ximage =+0+0 $picture & - WaitAndTryXglrAgain: - sleep 10 - xglaresrc $picture $glarefile >& /dev/null - if ($status == 2) goto WaitAndTryXglrAgain - endif + xglaresrc $picture $glarefile endif -set ndxnam=("Guth Visual Comfort Probability" "Guth Disability Glare Ratio" "CIE Glare Index") -set ndxcom=("glarendx -t guth_vcp" "glarendx -t guth_dgr" "glarendx -t cie_cgi") -set bcdlvl=(50 124 18.5) +set ndxnam=("Guth Visual Comfort Probability" "Guth Disability Glare Ratio" "CIE Glare Index" "BRS Glare Index" "Unified Glare Rating" "Daylight Glare Index") +set ndxcom=("glarendx -t guth_vcp" "glarendx -t guth_dgr" "glarendx -t cie_cgi" "glarendx -t brs_gi" "glarendx -t ugr" "glarendx -t dgi") +set bcdlvl=(50 124 18.5 18.5 18.5 21.7) while ( 1 ) echo "" echo " 0. Quit"