| 1 |
#!/bin/csh -f
|
| 2 |
# RCSid: $Id$
|
| 3 |
|
| 4 |
# Mark ambient locations J.Mardaljevic, [email protected]
|
| 5 |
|
| 6 |
set ambdat=none
|
| 7 |
set radius=0.05
|
| 8 |
|
| 9 |
alias readvar 'echo -n Enter \!:1 "[$\!:1]: ";set ans="$<";if("$ans" != "")set \!:1="$ans"'
|
| 10 |
|
| 11 |
cat <<_EOF_
|
| 12 |
|
| 13 |
CREATE SCENE DESCRIPTION MARKERS FOR
|
| 14 |
AMBIENT SAMPLING LOCATIONS
|
| 15 |
|
| 16 |
This script puts coloured markers (spheres) at points where hemispherical
|
| 17 |
sampling was initiated. The locations and levels are taken from the binary
|
| 18 |
ambient file. The levels are colour coded -
|
| 19 |
|
| 20 |
Level 0 = red
|
| 21 |
Level 1 = green
|
| 22 |
Level 2 = blue
|
| 23 |
Level 3 = yellow
|
| 24 |
Level 4 = cyan
|
| 25 |
Level 5 = magenta
|
| 26 |
Level 6 = pink
|
| 27 |
|
| 28 |
To view the locations, include the file "amb_pos.rad" when re-creating
|
| 29 |
the octree.
|
| 30 |
|
| 31 |
_EOF_
|
| 32 |
|
| 33 |
echo "Input ambient file"
|
| 34 |
readvar ambdat
|
| 35 |
|
| 36 |
echo "Input marker sphere radius"
|
| 37 |
readvar radius
|
| 38 |
|
| 39 |
getinfo $ambdat
|
| 40 |
lookamb -d -h $ambdat > af$$.tmp
|
| 41 |
|
| 42 |
set red=(1 0 0 1 0 1 1)
|
| 43 |
set grn=(0 1 0 1 1 0 0.5)
|
| 44 |
set blu=(0 0 1 0 1 1 0.5)
|
| 45 |
|
| 46 |
foreach j (1 2 3 4 5 6 7)
|
| 47 |
|
| 48 |
@ i = $j - 1
|
| 49 |
|
| 50 |
rcalc -e 'cond=eq($7,'"$i"');eq(a,b)=if(a-b+1e-7,b-a+1e-7,-1);$1=$1;$2=$2;$3=$3' af$$.tmp > amb_pos_lev$i
|
| 51 |
|
| 52 |
set empt=`wc -l < amb_pos_lev$i`
|
| 53 |
|
| 54 |
if ($empt !~ 0) then
|
| 55 |
|
| 56 |
echo "$empt ambient locations for level $i"
|
| 57 |
|
| 58 |
cat > sph_lev$i.fmt << _EOF_
|
| 59 |
|
| 60 |
mat_lev$i sphere sph_lev$i.\${recno}
|
| 61 |
0
|
| 62 |
0
|
| 63 |
4 \${ x1 } \${ y1 } \${ z1 } $radius
|
| 64 |
_EOF_
|
| 65 |
|
| 66 |
cat >> amb_pos.rad << _EOF_
|
| 67 |
void plastic mat_lev$i
|
| 68 |
0
|
| 69 |
0
|
| 70 |
5 $red[$j] $grn[$j] $blu[$j] 0 0
|
| 71 |
|
| 72 |
!rcalc -e 'x1=\$1;y1=\$2;z1=\$3' -o sph_lev$i.fmt amb_pos_lev$i
|
| 73 |
|
| 74 |
_EOF_
|
| 75 |
|
| 76 |
else
|
| 77 |
|
| 78 |
rm amb_pos_lev$i
|
| 79 |
|
| 80 |
endif
|
| 81 |
|
| 82 |
end
|
| 83 |
|
| 84 |
rm af$$.tmp
|