orig/objview.csh
author Axel Jacobs <axel@jaloxa.eu>
Mon, 14 Apr 2014 22:21:17 +0100
changeset 73 87fa3132a136
parent 0 0aa115157c9c
permissions -rw-r--r--
New IES test file with spaces in file name
axel@0
     1
#!/bin/csh -f
axel@0
     2
# RCSid: $Id: objview.csh,v 2.12 2009/01/13 22:19:25 greg Exp $
axel@0
     3
#
axel@0
     4
# Make a nice view of an object
axel@0
     5
# Arguments are scene input files
axel@0
     6
#
axel@0
     7
set tmpdir=/tmp
axel@0
     8
set octree=$tmpdir/ov$$.oct
axel@0
     9
set lights=$tmpdir/lt$$.rad
axel@0
    10
set rif=$tmpdir/ov$$.rif
axel@0
    11
set ambf=$tmpdir/af$$.amb
axel@0
    12
set tmpfiles="$octree $lights $rif $ambf"
axel@0
    13
set raddev="x11"
axel@0
    14
set up="Z"
axel@0
    15
set vw="XYZ"
axel@0
    16
set rendopts=""
axel@0
    17
set opts=""
axel@0
    18
while ($#argv > 0)
axel@0
    19
	switch ($argv[1])
axel@0
    20
	case -g*:
axel@0
    21
		set usegl
axel@0
    22
		breaksw
axel@0
    23
	case -u:
axel@0
    24
		shift argv
axel@0
    25
		set up=$argv[1]
axel@0
    26
		breaksw
axel@0
    27
	case -s:
axel@0
    28
	case -w:
axel@0
    29
		set opts=($opts $argv[1])
axel@0
    30
		breaksw
axel@0
    31
	case -b*:
axel@0
    32
		set rendopts=($rendopts -bv)
axel@0
    33
		breaksw
axel@0
    34
	case -v:
axel@0
    35
		shift argv
axel@0
    36
		set vw="$argv[1]"
axel@0
    37
		breaksw
axel@0
    38
	case -N:
axel@0
    39
		shift argv
axel@0
    40
		set opts=($opts -N $argv[1])
axel@0
    41
		set radopt
axel@0
    42
		breaksw
axel@0
    43
	case -o:
axel@0
    44
		shift argv
axel@0
    45
		set raddev="$argv[1]"
axel@0
    46
		set radopt
axel@0
    47
		breaksw
axel@0
    48
	case -V:
axel@0
    49
	case -e:
axel@0
    50
		set opts=($opts $argv[1])
axel@0
    51
		set radopt
axel@0
    52
		breaksw
axel@0
    53
	case -S:
axel@0
    54
		set opts=($opts $argv[1])
axel@0
    55
		set glradopt
axel@0
    56
		breaksw
axel@0
    57
	case -*:
axel@0
    58
		echo "Bad option: $argv[1]"
axel@0
    59
		exit 1
axel@0
    60
	default:
axel@0
    61
		break
axel@0
    62
	endsw
axel@0
    63
	shift argv
axel@0
    64
end
axel@0
    65
if ( $#argv == 0 ) then
axel@0
    66
	echo "No input files specified"
axel@0
    67
	exit 1
axel@0
    68
endif
axel@0
    69
if ( $?usegl ) then
axel@0
    70
	if ( $?radopt ) then
axel@0
    71
		echo "bad option for glrad"
axel@0
    72
		glrad
axel@0
    73
		exit 1
axel@0
    74
	endif
axel@0
    75
else
axel@0
    76
	if ( $?glradopt ) then
axel@0
    77
		echo "bad option for rad"
axel@0
    78
		rad
axel@0
    79
		exit 1
axel@0
    80
	endif
axel@0
    81
endif
axel@0
    82
axel@0
    83
onintr quit
axel@0
    84
axel@0
    85
cat > $lights <<_EOF_
axel@0
    86
void glow dim 0 0 4 .1 .1 .15 0
axel@0
    87
dim source background 0 0 4 0 0 1 360
axel@0
    88
void light bright 0 0 3 1000 1000 1000
axel@0
    89
bright source sun1 0 0 4 1 .2 1 5
axel@0
    90
bright source sun2 0 0 4 .3 1 1 5
axel@0
    91
bright source sun3 0 0 4 -1 -.7 1 5
axel@0
    92
_EOF_
axel@0
    93
axel@0
    94
cat > $rif <<_EOF_
axel@0
    95
scene= $argv[*]:q $lights
axel@0
    96
EXPOSURE= .5
axel@0
    97
UP= $up
axel@0
    98
view= $vw
axel@0
    99
OCTREE= $octree
axel@0
   100
oconv= -f
axel@0
   101
AMBF= $ambf
axel@0
   102
render= $rendopts
axel@0
   103
_EOF_
axel@0
   104
axel@0
   105
if ( $?usegl ) then
axel@0
   106
	glrad $opts $rif
axel@0
   107
else
axel@0
   108
	rad -o $raddev $opts $rif
axel@0
   109
endif
axel@0
   110
axel@0
   111
quit:
axel@0
   112
rm -f $tmpfiles
axel@0
   113
exit 0