1 |
greg |
1.1 |
#!/bin/csh -f |
2 |
greg |
2.7 |
# RCSid: $Id: objpict.csh,v 2.6 2009/07/22 17:35:06 greg Exp $ |
3 |
greg |
1.1 |
# |
4 |
|
|
# Make a nice multi-view picture of an object |
5 |
greg |
2.3 |
# Command line arguments contain materials and object files |
6 |
greg |
1.1 |
# |
7 |
greg |
2.6 |
set tmpdir=/tmp/objv$$ |
8 |
greg |
2.7 |
mkdir $tmpdir |
9 |
|
|
set xres=1024 |
10 |
|
|
set yres=1024 |
11 |
greg |
2.3 |
set rpict="rpict -av .2 .2 .2 -x $xres -y $yres" |
12 |
greg |
2.7 |
set inprad=op$$.rad |
13 |
greg |
2.6 |
set testroom=$tmpdir/testroom.rad |
14 |
|
|
set octree=$tmpdir/op.oct |
15 |
greg |
1.1 |
onintr quit |
16 |
greg |
2.3 |
if ( $#argv ) then |
17 |
|
|
cat $* > $inprad |
18 |
|
|
else |
19 |
|
|
cat > $inprad |
20 |
|
|
endif |
21 |
greg |
2.6 |
cat > $testroom << '_EOF_' |
22 |
|
|
void plastic wall_mat 0 0 5 .681 .543 .686 0 .2 |
23 |
|
|
void light bright 0 0 3 3000 3000 3000 |
24 |
|
|
bright sphere lamp0 0 0 4 4 4 -4 .1 |
25 |
|
|
bright sphere lamp1 0 0 4 4 0 4 .1 |
26 |
|
|
bright sphere lamp2 0 0 4 0 4 4 .1 |
27 |
|
|
wall_mat polygon box.1540 0 0 12 |
28 |
|
|
5 -5 -5 |
29 |
|
|
5 -5 5 |
30 |
|
|
-5 -5 5 |
31 |
|
|
-5 -5 -5 |
32 |
|
|
wall_mat polygon box.4620 0 0 12 |
33 |
|
|
-5 -5 5 |
34 |
|
|
-5 5 5 |
35 |
|
|
-5 5 -5 |
36 |
|
|
-5 -5 -5 |
37 |
|
|
wall_mat polygon box.2310 0 0 12 |
38 |
|
|
-5 5 -5 |
39 |
|
|
5 5 -5 |
40 |
|
|
5 -5 -5 |
41 |
|
|
-5 -5 -5 |
42 |
|
|
wall_mat polygon box.3267 0 0 12 |
43 |
|
|
5 5 -5 |
44 |
|
|
-5 5 -5 |
45 |
|
|
-5 5 5 |
46 |
|
|
5 5 5 |
47 |
|
|
wall_mat polygon box.5137 0 0 12 |
48 |
|
|
5 -5 5 |
49 |
|
|
5 -5 -5 |
50 |
|
|
5 5 -5 |
51 |
|
|
5 5 5 |
52 |
|
|
wall_mat polygon box.6457 0 0 12 |
53 |
|
|
-5 5 5 |
54 |
|
|
-5 -5 5 |
55 |
|
|
5 -5 5 |
56 |
|
|
5 5 5 |
57 |
|
|
'_EOF_' |
58 |
greg |
2.3 |
set dims=`getbbox -h $inprad` |
59 |
|
|
set siz=`rcalc -n -e 'max(a,b):if(a-b,a,b);$1='"max($dims[2]-$dims[1],max($dims[4]-$dims[3],$dims[6]-$dims[5]))"` |
60 |
greg |
1.1 |
set vw1="-vtl -vp 2 .5 .5 -vd -1 0 0 -vh 1 -vv 1" |
61 |
|
|
set vw2="-vtl -vp .5 2 .5 -vd 0 -1 0 -vh 1 -vv 1" |
62 |
|
|
set vw3="-vtl -vp .5 .5 2 -vd 0 0 -1 -vu -1 0 0 -vh 1 -vv 1" |
63 |
|
|
set vw4="-vp 3 3 3 -vd -1 -1 -1 -vh 20 -vv 20" |
64 |
|
|
|
65 |
greg |
2.3 |
xform -t `ev "-($dims[1]+$dims[2])/2" "-($dims[3]+$dims[4])/2" "-($dims[5]+$dims[6])/2"` \ |
66 |
|
|
-s `ev 1/$siz` -t .5 .5 .5 $inprad \ |
67 |
greg |
2.6 |
| oconv $testroom - > $octree |
68 |
greg |
2.7 |
pcompos "\!$rpict $vw3 $octree" 0 $yres \ |
69 |
|
|
"\!$rpict $vw4 $octree" $xres $yres \ |
70 |
|
|
"\!$rpict $vw1 $octree" 0 0 \ |
71 |
|
|
"\!$rpict $vw2 $octree" $xres 0 \ |
72 |
|
|
| pfilt -1 -r .6 -x /2 -y /2 |
73 |
greg |
1.1 |
|
74 |
|
|
quit: |
75 |
greg |
2.7 |
rm -r $tmpdir $inprad |
76 |
greg |
1.1 |
exit 0 |